From abafb52f37beb5659efc2105ccd1568e1f754898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Thu, 4 Dec 2014 18:29:42 +0100 Subject: make most headers private --- include/mbgl/geometry/anchor.hpp | 25 -- include/mbgl/geometry/binpack.hpp | 100 -------- include/mbgl/geometry/buffer.hpp | 118 ---------- include/mbgl/geometry/debug_font_buffer.hpp | 17 -- include/mbgl/geometry/elements_buffer.hpp | 63 ----- include/mbgl/geometry/fill_buffer.hpp | 21 -- include/mbgl/geometry/geometry.hpp | 77 ------ include/mbgl/geometry/glyph_atlas.hpp | 54 ----- include/mbgl/geometry/icon_buffer.hpp | 22 -- include/mbgl/geometry/line_buffer.hpp | 39 ---- include/mbgl/geometry/resample.hpp | 13 -- include/mbgl/geometry/sprite_atlas.hpp | 81 ------- include/mbgl/geometry/static_vertex_buffer.hpp | 26 --- include/mbgl/geometry/text_buffer.hpp | 25 -- include/mbgl/geometry/vao.hpp | 73 ------ include/mbgl/map/map.hpp | 12 +- include/mbgl/map/raster_tile_data.hpp | 33 --- include/mbgl/map/source.hpp | 86 ------- include/mbgl/map/sprite.hpp | 79 ------- include/mbgl/map/tile_data.hpp | 88 ------- include/mbgl/map/tile_parser.hpp | 77 ------ include/mbgl/map/transform_state.hpp | 1 - include/mbgl/map/vector_tile.hpp | 118 ---------- include/mbgl/map/vector_tile_data.hpp | 74 ------ .../platform/default/caching_http_file_source.hpp | 52 ----- include/mbgl/platform/gl.hpp | 4 +- include/mbgl/renderer/bucket.hpp | 24 -- include/mbgl/renderer/debug_bucket.hpp | 35 --- include/mbgl/renderer/fill_bucket.hpp | 88 ------- include/mbgl/renderer/frame_history.hpp | 40 ---- include/mbgl/renderer/line_bucket.hpp | 62 ----- include/mbgl/renderer/painter.hpp | 259 --------------------- include/mbgl/renderer/prerendered_texture.hpp | 37 --- include/mbgl/renderer/raster_bucket.hpp | 38 --- include/mbgl/renderer/symbol_bucket.hpp | 114 --------- include/mbgl/shader/dot_shader.hpp | 26 --- include/mbgl/shader/gaussian_shader.hpp | 25 -- include/mbgl/shader/icon_shader.hpp | 41 ---- include/mbgl/shader/line_shader.hpp | 32 --- include/mbgl/shader/linejoin_shader.hpp | 27 --- include/mbgl/shader/linepattern_shader.hpp | 33 --- include/mbgl/shader/outline_shader.hpp | 25 -- include/mbgl/shader/pattern_shader.hpp | 29 --- include/mbgl/shader/plain_shader.hpp | 24 -- include/mbgl/shader/raster_shader.hpp | 31 --- include/mbgl/shader/sdf_shader.hpp | 53 ----- include/mbgl/shader/shader.hpp | 28 --- include/mbgl/shader/uniform.hpp | 53 ----- include/mbgl/storage/base_request.hpp | 62 ----- include/mbgl/storage/caching_http_file_source.hpp | 52 +++++ include/mbgl/storage/file_request.hpp | 27 --- include/mbgl/storage/file_request_baton.hpp | 36 --- include/mbgl/storage/file_source.hpp | 5 +- include/mbgl/storage/http_request.hpp | 58 ----- include/mbgl/storage/http_request_baton.hpp | 2 +- include/mbgl/storage/request.hpp | 5 +- include/mbgl/storage/sqlite_store.hpp | 48 ---- include/mbgl/style/applied_class_properties.hpp | 39 ---- include/mbgl/style/class_dictionary.hpp | 37 --- include/mbgl/style/class_properties.hpp | 43 ---- include/mbgl/style/filter_expression.hpp | 125 ---------- include/mbgl/style/filter_expression_private.hpp | 118 ---------- include/mbgl/style/function_properties.hpp | 55 ----- include/mbgl/style/property_fallback.hpp | 29 --- include/mbgl/style/property_key.hpp | 70 ------ include/mbgl/style/property_transition.hpp | 15 -- include/mbgl/style/property_value.hpp | 21 -- include/mbgl/style/style.hpp | 68 ------ include/mbgl/style/style_bucket.hpp | 112 --------- include/mbgl/style/style_layer.hpp | 89 ------- include/mbgl/style/style_layer_group.hpp | 23 -- include/mbgl/style/style_parser.hpp | 113 --------- include/mbgl/style/style_properties.hpp | 114 --------- include/mbgl/style/style_source.hpp | 41 ---- include/mbgl/style/types.hpp | 196 ---------------- include/mbgl/style/value.hpp | 45 ---- include/mbgl/style/value_comparison.hpp | 109 --------- include/mbgl/text/collision.hpp | 58 ----- include/mbgl/text/glyph.hpp | 60 ----- include/mbgl/text/glyph_store.hpp | 99 -------- include/mbgl/text/placement.hpp | 31 --- include/mbgl/text/rotation_range.hpp | 54 ----- include/mbgl/text/types.hpp | 113 --------- include/mbgl/util/clip_ids.hpp | 38 --- include/mbgl/util/compression.hpp | 15 -- include/mbgl/util/constants.hpp | 33 --- include/mbgl/util/error.hpp | 20 -- include/mbgl/util/interpolate.hpp | 27 --- include/mbgl/util/io.hpp | 15 -- include/mbgl/util/mapbox.hpp | 17 -- include/mbgl/util/mat3.hpp | 42 ---- include/mbgl/util/optional.hpp | 69 ------ include/mbgl/util/pbf.hpp | 184 --------------- include/mbgl/util/queue.h | 92 -------- include/mbgl/util/raster.hpp | 74 ------ include/mbgl/util/rect.hpp | 22 -- include/mbgl/util/sqlite3.hpp | 74 ------ include/mbgl/util/stopwatch.hpp | 40 ---- include/mbgl/util/texture_pool.hpp | 25 -- include/mbgl/util/token.hpp | 50 ---- include/mbgl/util/transition.hpp | 78 ------- include/mbgl/util/unitbezier.hpp | 121 ---------- include/mbgl/util/url.hpp | 15 -- include/mbgl/util/uv-channel.h | 29 --- include/mbgl/util/uv-worker.h | 41 ---- include/mbgl/util/uv_detail.hpp | 177 -------------- include/mbgl/util/vec.hpp | 5 - 107 files changed, 67 insertions(+), 5910 deletions(-) delete mode 100644 include/mbgl/geometry/anchor.hpp delete mode 100644 include/mbgl/geometry/binpack.hpp delete mode 100644 include/mbgl/geometry/buffer.hpp delete mode 100644 include/mbgl/geometry/debug_font_buffer.hpp delete mode 100644 include/mbgl/geometry/elements_buffer.hpp delete mode 100644 include/mbgl/geometry/fill_buffer.hpp delete mode 100644 include/mbgl/geometry/geometry.hpp delete mode 100644 include/mbgl/geometry/glyph_atlas.hpp delete mode 100644 include/mbgl/geometry/icon_buffer.hpp delete mode 100644 include/mbgl/geometry/line_buffer.hpp delete mode 100644 include/mbgl/geometry/resample.hpp delete mode 100644 include/mbgl/geometry/sprite_atlas.hpp delete mode 100644 include/mbgl/geometry/static_vertex_buffer.hpp delete mode 100644 include/mbgl/geometry/text_buffer.hpp delete mode 100644 include/mbgl/geometry/vao.hpp delete mode 100644 include/mbgl/map/raster_tile_data.hpp delete mode 100644 include/mbgl/map/source.hpp delete mode 100644 include/mbgl/map/sprite.hpp delete mode 100644 include/mbgl/map/tile_data.hpp delete mode 100644 include/mbgl/map/tile_parser.hpp delete mode 100644 include/mbgl/map/vector_tile.hpp delete mode 100644 include/mbgl/map/vector_tile_data.hpp delete mode 100644 include/mbgl/platform/default/caching_http_file_source.hpp delete mode 100644 include/mbgl/renderer/bucket.hpp delete mode 100644 include/mbgl/renderer/debug_bucket.hpp delete mode 100644 include/mbgl/renderer/fill_bucket.hpp delete mode 100644 include/mbgl/renderer/frame_history.hpp delete mode 100644 include/mbgl/renderer/line_bucket.hpp delete mode 100644 include/mbgl/renderer/painter.hpp delete mode 100644 include/mbgl/renderer/prerendered_texture.hpp delete mode 100644 include/mbgl/renderer/raster_bucket.hpp delete mode 100644 include/mbgl/renderer/symbol_bucket.hpp delete mode 100644 include/mbgl/shader/dot_shader.hpp delete mode 100644 include/mbgl/shader/gaussian_shader.hpp delete mode 100644 include/mbgl/shader/icon_shader.hpp delete mode 100644 include/mbgl/shader/line_shader.hpp delete mode 100644 include/mbgl/shader/linejoin_shader.hpp delete mode 100644 include/mbgl/shader/linepattern_shader.hpp delete mode 100644 include/mbgl/shader/outline_shader.hpp delete mode 100644 include/mbgl/shader/pattern_shader.hpp delete mode 100644 include/mbgl/shader/plain_shader.hpp delete mode 100644 include/mbgl/shader/raster_shader.hpp delete mode 100644 include/mbgl/shader/sdf_shader.hpp delete mode 100644 include/mbgl/shader/shader.hpp delete mode 100644 include/mbgl/shader/uniform.hpp delete mode 100644 include/mbgl/storage/base_request.hpp create mode 100644 include/mbgl/storage/caching_http_file_source.hpp delete mode 100644 include/mbgl/storage/file_request.hpp delete mode 100644 include/mbgl/storage/file_request_baton.hpp delete mode 100644 include/mbgl/storage/http_request.hpp delete mode 100644 include/mbgl/storage/sqlite_store.hpp delete mode 100644 include/mbgl/style/applied_class_properties.hpp delete mode 100644 include/mbgl/style/class_dictionary.hpp delete mode 100644 include/mbgl/style/class_properties.hpp delete mode 100644 include/mbgl/style/filter_expression.hpp delete mode 100644 include/mbgl/style/filter_expression_private.hpp delete mode 100644 include/mbgl/style/function_properties.hpp delete mode 100644 include/mbgl/style/property_fallback.hpp delete mode 100644 include/mbgl/style/property_key.hpp delete mode 100644 include/mbgl/style/property_transition.hpp delete mode 100644 include/mbgl/style/property_value.hpp delete mode 100644 include/mbgl/style/style.hpp delete mode 100644 include/mbgl/style/style_bucket.hpp delete mode 100644 include/mbgl/style/style_layer.hpp delete mode 100644 include/mbgl/style/style_layer_group.hpp delete mode 100644 include/mbgl/style/style_parser.hpp delete mode 100644 include/mbgl/style/style_properties.hpp delete mode 100644 include/mbgl/style/style_source.hpp delete mode 100644 include/mbgl/style/types.hpp delete mode 100644 include/mbgl/style/value.hpp delete mode 100644 include/mbgl/style/value_comparison.hpp delete mode 100644 include/mbgl/text/collision.hpp delete mode 100644 include/mbgl/text/glyph.hpp delete mode 100644 include/mbgl/text/glyph_store.hpp delete mode 100644 include/mbgl/text/placement.hpp delete mode 100644 include/mbgl/text/rotation_range.hpp delete mode 100644 include/mbgl/text/types.hpp delete mode 100644 include/mbgl/util/clip_ids.hpp delete mode 100644 include/mbgl/util/compression.hpp delete mode 100644 include/mbgl/util/constants.hpp delete mode 100644 include/mbgl/util/error.hpp delete mode 100644 include/mbgl/util/interpolate.hpp delete mode 100644 include/mbgl/util/io.hpp delete mode 100644 include/mbgl/util/mapbox.hpp delete mode 100644 include/mbgl/util/mat3.hpp delete mode 100644 include/mbgl/util/optional.hpp delete mode 100644 include/mbgl/util/pbf.hpp delete mode 100644 include/mbgl/util/queue.h delete mode 100644 include/mbgl/util/raster.hpp delete mode 100644 include/mbgl/util/rect.hpp delete mode 100644 include/mbgl/util/sqlite3.hpp delete mode 100644 include/mbgl/util/stopwatch.hpp delete mode 100644 include/mbgl/util/texture_pool.hpp delete mode 100644 include/mbgl/util/token.hpp delete mode 100644 include/mbgl/util/transition.hpp delete mode 100644 include/mbgl/util/unitbezier.hpp delete mode 100644 include/mbgl/util/url.hpp delete mode 100644 include/mbgl/util/uv-channel.h delete mode 100644 include/mbgl/util/uv-worker.h delete mode 100644 include/mbgl/util/uv_detail.hpp (limited to 'include/mbgl') diff --git a/include/mbgl/geometry/anchor.hpp b/include/mbgl/geometry/anchor.hpp deleted file mode 100644 index d30394f0b9..0000000000 --- a/include/mbgl/geometry/anchor.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef MBGL_GEOMETRY_ANCHOR -#define MBGL_GEOMETRY_ANCHOR - -#include - -namespace mbgl { - -struct Anchor { - float x = 0.0f; - float y = 0.0f; - float angle = 0.0f; - float scale = 0.0f; - int segment = -1; - - explicit Anchor(float x_, float y_, float angle_, float scale_) - : x(x_), y(y_), angle(angle_), scale(scale_) {} - explicit Anchor(float x_, float y_, float angle_, float scale_, int segment_) - : x(x_), y(y_), angle(angle_), scale(scale_), segment(segment_) {} -}; - -typedef std::vector Anchors; - -} - -#endif \ No newline at end of file diff --git a/include/mbgl/geometry/binpack.hpp b/include/mbgl/geometry/binpack.hpp deleted file mode 100644 index 9aadaa202c..0000000000 --- a/include/mbgl/geometry/binpack.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef MBGL_GEOMETRY_BINPACK -#define MBGL_GEOMETRY_BINPACK - -#include -#include -#include -#include - -namespace mbgl { - -template -class BinPack : private util::noncopyable { -public: - BinPack(T width, T height) - : free(1, Rect{ 0, 0, width, height }) {} -public: - Rect allocate(T width, T height) { - // Find the smallest free rect angle - auto smallest = free.end(); - for (auto it = free.begin(); it != free.end(); ++it) { - const Rect& ref = *it; - const Rect& rect = *smallest; - if (width <= ref.w && height <= ref.h) { - if (smallest == free.end() || (ref.y <= rect.y && ref.x <= rect.x)) { - smallest = it; - } - } - } - - if (smallest == free.end()) { - // There's no space left for this char. - return Rect{ 0, 0, 0, 0 }; - } else { - Rect rect = *smallest; - free.erase(smallest); - - // Shorter/Longer Axis Split Rule (SAS) - // http://clb.demon.fi/files/RectangleBinPack.pdf p. 15 - // Ignore the dimension of R and just split long the shorter dimension - // See Also: http://www.cs.princeton.edu/~chazelle/pubs/blbinpacking.pdf - if (rect.w < rect.h) { - // split horizontally - // +--+---+ - // |__|___| <-- b1 - // +------+ <-- b2 - if (rect.w > width) free.emplace_back(rect.x + width, rect.y, rect.w - width, height); - if (rect.h > height) free.emplace_back(rect.x, rect.y + height, rect.w, rect.h - height); - } else { - // split vertically - // +--+---+ - // |__| | <-- b1 - // +--|---+ <-- b2 - if (rect.w > width) free.emplace_back(rect.x + width, rect.y, rect.w - width, rect.h); - if (rect.h > height) free.emplace_back(rect.x, rect.y + height, width, rect.h - height); - } - - return Rect{ rect.x, rect.y, width, height }; - } - } - - - void release(Rect rect) { - // Simple algorithm to recursively merge the newly released cell with its - // neighbor. This doesn't merge more than two cells at a time, and fails - // for complicated merges. - for (auto it = free.begin(); it != free.end(); ++it) { - Rect ref = *it; - if (ref.y == rect.y && ref.h == rect.h && ref.x + ref.w == rect.x) { - ref.w += rect.w; - } - else if (ref.x == rect.x && ref.w == rect.w && ref.y + ref.h == rect.y) { - ref.h += rect.h; - } - else if (rect.y == ref.y && rect.h == ref.h && rect.x + rect.w == ref.x) { - ref.x = rect.x; - ref.w += rect.w; - } - else if (rect.x == ref.x && rect.w == ref.w && rect.y + rect.h == ref.y) { - ref.y = rect.y; - ref.h += rect.h; - } else { - continue; - } - - free.erase(it); - release(ref); - return; - - } - - free.emplace_back(rect); - }; - -private: - std::list> free; -}; - -} - -#endif diff --git a/include/mbgl/geometry/buffer.hpp b/include/mbgl/geometry/buffer.hpp deleted file mode 100644 index 80cc6b9d1a..0000000000 --- a/include/mbgl/geometry/buffer.hpp +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef MBGL_GEOMETRY_BUFFER -#define MBGL_GEOMETRY_BUFFER - -#include -#include - -#include -#include -#include - -namespace mbgl { - -template < - size_t item_size, - int bufferType = GL_ARRAY_BUFFER, - size_t defaultLength = 8192, - bool retainAfterUpload = false -> -class Buffer : private util::noncopyable { -public: - ~Buffer() { - cleanup(); - if (buffer != 0) { - glDeleteBuffers(1, &buffer); - buffer = 0; - } - } - - // Returns the number of elements in this buffer. This is not the number of - // bytes, but rather the number of coordinates with associated information. - inline size_t index() const { - return pos / itemSize; - } - - inline bool empty() const { - return pos == 0; - } - - // Transfers this buffer to the GPU and binds the buffer to the GL context. - void bind(bool force = false) { - if (buffer == 0) { - glGenBuffers(1, &buffer); - force = true; - } - glBindBuffer(bufferType, buffer); - if (force) { - if (array == nullptr) { - throw std::runtime_error("Buffer was already deleted or doesn't contain elements"); - } - - glBufferData(bufferType, pos, array, GL_STATIC_DRAW); - if (!retainAfterUpload) { - cleanup(); - } - } - } - - void cleanup() { - if (array) { - free(array); - array = nullptr; - } - } - - inline GLuint getID() const { - return buffer; - } - -protected: - // increase the buffer size by at least /required/ bytes. - inline void *addElement() { - if (buffer != 0) { - throw std::runtime_error("Can't add elements after buffer was bound to GPU"); - } - if (length < pos + itemSize) { - while (length < pos + itemSize) length += defaultLength; - array = realloc(array, length); - if (array == nullptr) { - throw std::runtime_error("Buffer reallocation failed"); - } - } - pos += itemSize; - return static_cast(array) + (pos - itemSize); - } - - // Get a pointer to the item at a given index. - inline void *getElement(size_t i) { - if (array == nullptr) { - throw std::runtime_error("Buffer was already deleted or doesn't contain elements"); - } - - if (i * itemSize >= pos) { - throw new std::runtime_error("Can't get element after array bounds"); - } else { - return static_cast(array) + (i * itemSize); - } - } - -public: - static const size_t itemSize = item_size; - -private: - // CPU buffer - void *array = nullptr; - - // Byte position where we are writing. - size_t pos = 0; - - // Number of bytes that are valid in this buffer. - size_t length = 0; - - // GL buffer ID - GLuint buffer = 0; -}; - -} - -#endif diff --git a/include/mbgl/geometry/debug_font_buffer.hpp b/include/mbgl/geometry/debug_font_buffer.hpp deleted file mode 100644 index 7cceb0f576..0000000000 --- a/include/mbgl/geometry/debug_font_buffer.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MBGL_GEOMETRY_DEBUG_FONT_BUFFER -#define MBGL_GEOMETRY_DEBUG_FONT_BUFFER - -#include "buffer.hpp" - -namespace mbgl { - -class DebugFontBuffer : public Buffer< - 4 // 2 bytes per coordinate, 2 coordinates -> { -public: - void addText(const char *text, double left, double baseline, double scale = 1); -}; - -} - -#endif diff --git a/include/mbgl/geometry/elements_buffer.hpp b/include/mbgl/geometry/elements_buffer.hpp deleted file mode 100644 index 045560f9aa..0000000000 --- a/include/mbgl/geometry/elements_buffer.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef MBGL_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER -#define MBGL_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER - -#include -#include -#include - -#include - -namespace mbgl { - -template -struct ElementGroup : public util::noncopyable { - std::array array; - uint32_t vertex_length; - uint32_t elements_length; - - ElementGroup() : vertex_length(0), elements_length(0) {} - ElementGroup(uint32_t vertex_length_, uint32_t elements_length_) - : vertex_length(vertex_length_), - elements_length(elements_length_) { - } - - ElementGroup(ElementGroup &&rhs) noexcept - : array(std::move(rhs.array)), - vertex_length(rhs.vertex_length), - elements_length(rhs.elements_length) {}; -}; - -class TriangleElementsBuffer : public Buffer< - 6, // bytes per triangle (3 * unsigned short == 6 bytes) - GL_ELEMENT_ARRAY_BUFFER -> { -public: - typedef uint16_t element_type; - - void add(element_type a, element_type b, element_type c); -}; - - -class LineElementsBuffer : public Buffer< - 4, // bytes per triangle (2 * unsigned short == 6 bytes) - GL_ELEMENT_ARRAY_BUFFER -> { -public: - typedef uint16_t element_type; - - void add(element_type a, element_type b); -}; - -class PointElementsBuffer : public Buffer< - 2, // bytes per point (1 unsigned short) - GL_ELEMENT_ARRAY_BUFFER -> { -public: - typedef uint16_t element_type; - - void add(element_type a); -}; - -} - -#endif diff --git a/include/mbgl/geometry/fill_buffer.hpp b/include/mbgl/geometry/fill_buffer.hpp deleted file mode 100644 index 4a3d5a5b38..0000000000 --- a/include/mbgl/geometry/fill_buffer.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef MBGL_GEOMETRY_FILL_BUFFER -#define MBGL_GEOMETRY_FILL_BUFFER - -#include "buffer.hpp" -#include -#include - -namespace mbgl { - -class FillVertexBuffer : public Buffer< - 4 // bytes per coordinates (2 * unsigned short == 4 bytes) -> { -public: - typedef int16_t vertex_type; - - void add(vertex_type x, vertex_type y); -}; - -} - -#endif diff --git a/include/mbgl/geometry/geometry.hpp b/include/mbgl/geometry/geometry.hpp deleted file mode 100644 index 484d17b36d..0000000000 --- a/include/mbgl/geometry/geometry.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef MBGL_GEOMETRY_GEOMETRY -#define MBGL_GEOMETRY_GEOMETRY - -#include -#include - -#include - -namespace mbgl { - -class Geometry : private util::noncopyable { - -public: - inline explicit Geometry(pbf& data); - - enum command : uint8_t { - end = 0, - move_to = 1, - line_to = 2, - close = 7 - }; - - inline command next(int32_t &rx, int32_t &ry); - -private: - pbf& data; - uint8_t cmd; - uint32_t length; - int32_t x, y; - int32_t ox, oy; -}; - -Geometry::Geometry(pbf& data_) - : data(data_), - cmd(1), - length(0), - x(0), y(0), - ox(0), oy(0) {} - -Geometry::command Geometry::next(int32_t &rx, int32_t &ry) { - if (data.data < data.end) { - if (length == 0) { - uint32_t cmd_length = static_cast(data.varint()); - cmd = cmd_length & 0x7; - length = cmd_length >> 3; - } - - --length; - - if (cmd == move_to || cmd == line_to) { - rx = (x += data.svarint()); - ry = (y += data.svarint()); - - if (cmd == move_to) { - ox = x; - oy = y; - return move_to; - } else { - return line_to; - } - } else if (cmd == close) { - rx = ox; - ry = oy; - return close; - } else { - fprintf(stderr, "unknown command: %d\n", cmd); - // TODO: gracefully handle geometry parse failures - return end; - } - } else { - return end; - } -} - -} - -#endif diff --git a/include/mbgl/geometry/glyph_atlas.hpp b/include/mbgl/geometry/glyph_atlas.hpp deleted file mode 100644 index 7b3c223fe5..0000000000 --- a/include/mbgl/geometry/glyph_atlas.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef MBGL_GEOMETRY_GLYPH_ATLAS -#define MBGL_GEOMETRY_GLYPH_ATLAS - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace mbgl { - -class GlyphAtlas : public util::noncopyable { -public: - -private: - struct GlyphValue { - GlyphValue(const Rect& rect_, uint64_t id) - : rect(rect_), ids({ id }) {} - Rect rect; - std::set ids; - }; - - Rect addGlyph_impl(uint64_t tile_id, const std::string& face_name, - const SDFGlyph& glyph); -public: - GlyphAtlas(uint16_t width, uint16_t height); - - Rect addGlyph(uint64_t tile_id, const std::string& face_name, - const SDFGlyph& glyph); - void addGlyphs(uint64_t tileid, std::u32string const& text, std::string const& stackname, - FontStack const& fontStack, GlyphPositions & face); - void removeGlyphs(uint64_t tile_id); - void bind(); - -public: - const uint16_t width = 0; - const uint16_t height = 0; - -private: - std::mutex mtx; - BinPack bin; - std::map> index; - std::unique_ptr data; - std::atomic dirty; - uint32_t texture = 0; -}; - -}; - -#endif diff --git a/include/mbgl/geometry/icon_buffer.hpp b/include/mbgl/geometry/icon_buffer.hpp deleted file mode 100644 index e7e5f40355..0000000000 --- a/include/mbgl/geometry/icon_buffer.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MBGL_GEOMETRY_ICON_BUFFER -#define MBGL_GEOMETRY_ICON_BUFFER - -#include "buffer.hpp" - -#include - -namespace mbgl { - - class IconVertexBuffer : public Buffer< - 20 - > { - public: - static const double angleFactor; - - size_t add(int16_t x, int16_t y, float ox, float oy, int16_t tx, int16_t ty, float angle, float minzoom, std::array range, float maxzoom, float labelminzoom); - - }; - -} - -#endif diff --git a/include/mbgl/geometry/line_buffer.hpp b/include/mbgl/geometry/line_buffer.hpp deleted file mode 100644 index 5012bb12ac..0000000000 --- a/include/mbgl/geometry/line_buffer.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef MBGL_GEOMETRY_LINE_BUFFER -#define MBGL_GEOMETRY_LINE_BUFFER - -#include "buffer.hpp" - -namespace mbgl { - -class LineVertexBuffer : public Buffer< - 8 // 2 coordinates per vertex + 1 linesofar + 1 extrude coord pair == 4 (== 8 bytes) -> { -public: - typedef int16_t vertex_type; - - /* - * Scale the extrusion vector so that the normal length is this value. - * Contains the "texture" normals (-1..1). This is distinct from the extrude - * normals for line joins, because the x-value remains 0 for the texture - * normal array, while the extrude normal actually moves the vertex to create - * the acute/bevelled line join. - */ - static const int8_t extrudeScale = 63; - - /* - * Add a vertex to this buffer - * - * @param {number} x vertex position - * @param {number} y vertex position - * @param {number} ex extrude normal - * @param {number} ey extrude normal - * @param {number} tx texture normal - * @param {number} ty texture normal - */ - size_t add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar = 0); -}; - - -} - -#endif diff --git a/include/mbgl/geometry/resample.hpp b/include/mbgl/geometry/resample.hpp deleted file mode 100644 index bcfe4ca53d..0000000000 --- a/include/mbgl/geometry/resample.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef MBGL_GEOMETRY_INTERPOLATE -#define MBGL_GEOMETRY_INTERPOLATE - -#include -#include - -namespace mbgl { - -Anchors resample(const std::vector &vertices, float spacing, - float minScale, float maxScale, float tilePixelRatio, int start = 0); -} - -#endif diff --git a/include/mbgl/geometry/sprite_atlas.hpp b/include/mbgl/geometry/sprite_atlas.hpp deleted file mode 100644 index 9fb42a30b5..0000000000 --- a/include/mbgl/geometry/sprite_atlas.hpp +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef MBGL_GEOMETRY_SPRITE_ATLAS -#define MBGL_GEOMETRY_SPRITE_ATLAS - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace mbgl { - -class Sprite; -class SpritePosition; - -struct SpriteAtlasPosition { - std::array size; - std::array tl; - std::array br; -}; - -class SpriteAtlas : public util::noncopyable { -public: - typedef uint16_t dimension; - - // Add way to construct this from another SpriteAtlas (e.g. with another pixelRatio) - SpriteAtlas(dimension width, dimension height); - ~SpriteAtlas(); - - // Changes the pixel ratio. - bool resize(float newRatio); - - // Changes the source sprite. - void setSprite(util::ptr sprite); - - // Returns the coordinates of an image that is sourced from the sprite image. - // This getter attempts to read the image from the sprite if it is already loaded. - // In that case, it copies it into the sprite atlas and returns the dimensions. - // Otherwise, it returns a 0/0/0/0 rect. - Rect getImage(const std::string& name); - - SpriteAtlasPosition getPosition(const std::string& name, bool repeating = false); - - // Binds the image buffer of this sprite atlas to the GPU, and uploads data if it is out - // of date. - void bind(bool linear = false); - - inline float getWidth() const { return width; } - inline float getHeight() const { return height; } - inline float getTextureWidth() const { return width * pixelRatio; } - inline float getTextureHeight() const { return height * pixelRatio; } - inline float getPixelRatio() const { return pixelRatio; } - - const dimension width = 0; - const dimension height = 0; - -private: - void allocate(); - Rect allocateImage(size_t width, size_t height); - void copy(const Rect& dst, const SpritePosition& src); - - std::recursive_mutex mtx; - float pixelRatio = 1.0f; - BinPack bin; - util::ptr sprite; - std::map> images; - std::set uninitialized; - uint32_t *data = nullptr; - std::atomic dirty; - uint32_t texture = 0; - uint32_t filter = 0; - static const int buffer = 1; -}; - -}; - -#endif diff --git a/include/mbgl/geometry/static_vertex_buffer.hpp b/include/mbgl/geometry/static_vertex_buffer.hpp deleted file mode 100644 index ce932269f0..0000000000 --- a/include/mbgl/geometry/static_vertex_buffer.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MBGL_GEOMETRY_STATIC_VERTEX_BUFFER -#define MBGL_GEOMETRY_STATIC_VERTEX_BUFFER - -#include - -#include -#include -#include -#include - -namespace mbgl { - -class StaticVertexBuffer : public Buffer< - 4, // bytes per vertex (2 * signed short == 4 bytes) - GL_ARRAY_BUFFER, - 32 // default length -> { -public: - typedef int16_t vertex_type; - - StaticVertexBuffer(std::initializer_list> init); -}; - -} - -#endif diff --git a/include/mbgl/geometry/text_buffer.hpp b/include/mbgl/geometry/text_buffer.hpp deleted file mode 100644 index 159f3207a8..0000000000 --- a/include/mbgl/geometry/text_buffer.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef MBGL_GEOMETRY_TEXT_BUFFER -#define MBGL_GEOMETRY_TEXT_BUFFER - -#include "buffer.hpp" -#include - -namespace mbgl { - -class TextVertexBuffer : public Buffer < - 16, - GL_ARRAY_BUFFER, - 32768 -> { -public: - typedef int16_t vertex_type; - - static const double angleFactor; - - size_t add(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float angle, float minzoom, std::array range, float maxzoom, float labelminzoom); -}; - - -} - -#endif diff --git a/include/mbgl/geometry/vao.hpp b/include/mbgl/geometry/vao.hpp deleted file mode 100644 index 2ecba731f7..0000000000 --- a/include/mbgl/geometry/vao.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef MBGL_GEOMETRY_VAO -#define MBGL_GEOMETRY_VAO - -#include -#include -#include - -#include - -namespace mbgl { - -class VertexArrayObject : public util::noncopyable { -public: - inline VertexArrayObject() {}; - - inline VertexArrayObject(VertexArrayObject &&rhs) noexcept - : vao(rhs.vao), - bound_shader(rhs.bound_shader), - bound_shader_name(rhs.bound_shader_name), - bound_vertex_buffer(rhs.bound_vertex_buffer), - bound_elements_buffer(rhs.bound_elements_buffer), - bound_offset(rhs.bound_offset) {}; - - template - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, char *offset) { - bindVertexArrayObject(); - if (bound_shader == 0) { - vertexBuffer.bind(); - shader.bind(offset); - if (vao) { - storeBinding(shader, vertexBuffer.getID(), 0, offset); - } - } else { - verifyBinding(shader, vertexBuffer.getID(), 0, offset); - } - } - - template - inline void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, char *offset) { - bindVertexArrayObject(); - if (bound_shader == 0) { - vertexBuffer.bind(); - elementsBuffer.bind(); - shader.bind(offset); - if (vao) { - storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); - } - } else { - verifyBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); - } - } - - ~VertexArrayObject(); - -private: - void bindVertexArrayObject(); - void storeBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, char *offset); - void verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, char *offset); - - GLuint vao = 0; - - // For debug reasons, we're storing the bind information so that we can - // detect errors and report - GLuint bound_shader = 0; - const char *bound_shader_name = ""; - GLuint bound_vertex_buffer = 0; - GLuint bound_elements_buffer = 0; - char *bound_offset = 0; -}; - -} - -#endif diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 4e6eef89cf..3a50a70136 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -2,9 +2,6 @@ #define MBGL_MAP_MAP #include -#include -#include -#include #include #include #include @@ -19,6 +16,7 @@ namespace mbgl { +class Painter; class GlyphStore; class LayerDescription; class Sprite; @@ -29,6 +27,8 @@ class StyleSource; class TexturePool; class FileSource; class View; +class GlyphAtlas; +class SpriteAtlas; class Map : private util::noncopyable { typedef void (*stop_callback)(void *); @@ -182,13 +182,13 @@ private: FileSource& fileSource; util::ptr