diff --git a/src/mbgl/geometry/glyph_atlas.cpp b/src/mbgl/geometry/glyph_atlas.cpp index 6fcb4ecf8..f690004b5 100644 --- a/src/mbgl/geometry/glyph_atlas.cpp +++ b/src/mbgl/geometry/glyph_atlas.cpp @@ -18,7 +18,7 @@ GlyphAtlas::GlyphAtlas(uint16_t width_, uint16_t height_) dirty(true) { } -void GlyphAtlas::addGlyphs(uint64_t tileID, +void GlyphAtlas::addGlyphs(uintptr_t tileUID, const std::u32string& text, const std::string& stackName, const FontStack& fontStack, @@ -36,12 +36,12 @@ void GlyphAtlas::addGlyphs(uint64_t tileID, } const SDFGlyph& sdf = sdf_it->second; - Rect rect = addGlyph(tileID, stackName, sdf); + Rect rect = addGlyph(tileUID, stackName, sdf); face.emplace(chr, Glyph{rect, sdf.metrics}); } } -Rect GlyphAtlas::addGlyph(uint64_t tileID, +Rect GlyphAtlas::addGlyph(uintptr_t tileUID, const std::string& stackName, const SDFGlyph& glyph) { @@ -54,7 +54,7 @@ Rect GlyphAtlas::addGlyph(uint64_t tileID, // The glyph is already in this texture. if (it != face.end()) { GlyphValue& value = it->second; - value.ids.insert(tileID); + value.ids.insert(tileUID); return value.rect; } @@ -85,7 +85,7 @@ Rect GlyphAtlas::addGlyph(uint64_t tileID, assert(rect.x + rect.w <= width); assert(rect.y + rect.h <= height); - face.emplace(glyph.id, GlyphValue { rect, tileID }); + face.emplace(glyph.id, GlyphValue { rect, tileUID }); // Copy the bitmap char *target = data.get(); @@ -103,14 +103,14 @@ Rect GlyphAtlas::addGlyph(uint64_t tileID, return rect; } -void GlyphAtlas::removeGlyphs(uint64_t tile_id) { +void GlyphAtlas::removeGlyphs(uintptr_t tileUID) { std::lock_guard lock(mtx); for (auto& faces : index) { std::map& face = faces.second; for (auto it = face.begin(); it != face.end(); /* we advance in the body */) { GlyphValue& value = it->second; - value.ids.erase(tile_id); + value.ids.erase(tileUID); if (!value.ids.size()) { const Rect& rect = value.rect; diff --git a/src/mbgl/geometry/glyph_atlas.hpp b/src/mbgl/geometry/glyph_atlas.hpp index 19550ea4d..a25c735a8 100644 --- a/src/mbgl/geometry/glyph_atlas.hpp +++ b/src/mbgl/geometry/glyph_atlas.hpp @@ -17,12 +17,12 @@ class GlyphAtlas : public util::noncopyable { public: GlyphAtlas(uint16_t width, uint16_t height); - void addGlyphs(uint64_t tileID, + void addGlyphs(uintptr_t tileUID, const std::u32string& text, const std::string& stackName, const FontStack&, GlyphPositions&); - void removeGlyphs(uint64_t tile_id); + void removeGlyphs(uintptr_t tileUID); void bind(); @@ -31,13 +31,13 @@ public: private: struct GlyphValue { - GlyphValue(const Rect& rect_, uint64_t id) + GlyphValue(const Rect& rect_, uintptr_t id) : rect(rect_), ids({ id }) {} Rect rect; - std::set ids; + std::set ids; }; - Rect addGlyph(uint64_t tileID, + Rect addGlyph(uintptr_t tileID, const std::string& stackName, const SDFGlyph&); diff --git a/src/mbgl/map/tile_parser.cpp b/src/mbgl/map/tile_parser.cpp index c50c394e2..0540c7d7d 100644 --- a/src/mbgl/map/tile_parser.cpp +++ b/src/mbgl/map/tile_parser.cpp @@ -256,7 +256,7 @@ std::unique_ptr TileParser::createSymbolBucket(const GeometryTileLayer& auto symbol = parseStyleLayoutSymbol(bucket_desc, tile.id.z); auto bucket = util::make_unique(std::move(symbol), *collision); bucket->addFeatures( - layer, bucket_desc.filter, tile.id, spriteAtlas, *sprite, glyphAtlas, glyphStore); + layer, bucket_desc.filter, reinterpret_cast(&tile), spriteAtlas, *sprite, glyphAtlas, glyphStore); return obsolete() ? nullptr : std::move(bucket); } } diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 66fed0706..e165863be 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -25,7 +25,7 @@ VectorTileData::VectorTileData(Tile::ID const& id_, } VectorTileData::~VectorTileData() { - glyphAtlas.removeGlyphs(id.to_uint64()); + glyphAtlas.removeGlyphs(reinterpret_cast(this)); } diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp index 7e587e7ee..2c28d7219 100644 --- a/src/mbgl/renderer/symbol_bucket.cpp +++ b/src/mbgl/renderer/symbol_bucket.cpp @@ -124,8 +124,11 @@ std::vector SymbolBucket::processFeatures(const GeometryTileLayer void SymbolBucket::addFeatures(const GeometryTileLayer& layer, const FilterExpression& filter, - const Tile::ID &id, SpriteAtlas &spriteAtlas, Sprite &sprite, - GlyphAtlas & glyphAtlas, GlyphStore &glyphStore) { + uintptr_t tileUID, + SpriteAtlas& spriteAtlas, + Sprite& sprite, + GlyphAtlas& glyphAtlas, + GlyphStore& glyphStore) { auto &layout = *styleLayout; const std::vector features = processFeatures(layer, filter, glyphStore, sprite); @@ -193,7 +196,7 @@ void SymbolBucket::addFeatures(const GeometryTileLayer& layer, // Add the glyphs we need for this label to the glyph atlas. if (shaping.size()) { - glyphAtlas.addGlyphs(id.to_uint64(), feature.label, layout.text.font, fontStack, face); + glyphAtlas.addGlyphs(tileUID, feature.label, layout.text.font, fontStack, face); } } diff --git a/src/mbgl/renderer/symbol_bucket.hpp b/src/mbgl/renderer/symbol_bucket.hpp index 26cf22c54..b7291c186 100644 --- a/src/mbgl/renderer/symbol_bucket.hpp +++ b/src/mbgl/renderer/symbol_bucket.hpp @@ -67,7 +67,7 @@ public: void addFeatures(const GeometryTileLayer&, const FilterExpression&, - const Tile::ID&, + uintptr_t tileUID, SpriteAtlas&, Sprite&, GlyphAtlas&,