diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-10-02 17:03:50 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2018-10-15 13:15:46 -0700 |
commit | ce76bde13d0f4381ee861f81daf636defaff0bc5 (patch) | |
tree | e37d93d14fc64620069bac5488bae871af2fa431 /src/mbgl/tile | |
parent | bc718257748f1ad87658e85f8c31b574afca57a9 (diff) | |
download | qtlocation-mapboxgl-ce76bde13d0f4381ee861f81daf636defaff0bc5.tar.gz |
[core] Initial implementation of 'format' expression
Diffstat (limited to 'src/mbgl/tile')
-rw-r--r-- | src/mbgl/tile/geometry_tile_worker.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp index c9032894a4..e16b805f6b 100644 --- a/src/mbgl/tile/geometry_tile_worker.cpp +++ b/src/mbgl/tile/geometry_tile_worker.cpp @@ -252,18 +252,24 @@ void GeometryTileWorker::coalesce() { void GeometryTileWorker::onGlyphsAvailable(GlyphMap newGlyphMap) { for (auto& newFontGlyphs : newGlyphMap) { - const FontStack& fontStack = newFontGlyphs.first; + FontStackHash fontStack = newFontGlyphs.first; Glyphs& newGlyphs = newFontGlyphs.second; Glyphs& glyphs = glyphMap[fontStack]; - GlyphIDs& pendingGlyphIDs = pendingGlyphDependencies[fontStack]; - - for (auto& newGlyph : newGlyphs) { - const GlyphID& glyphID = newGlyph.first; - optional<Immutable<Glyph>>& glyph = newGlyph.second; - - if (pendingGlyphIDs.erase(glyphID)) { - glyphs.emplace(glyphID, std::move(glyph)); + for (auto& pendingGlyphDependency : pendingGlyphDependencies) { + // Linear lookup here to handle reverse of FontStackHash -> FontStack, + // since dependencies need the full font stack name to make a request + // There should not be many fontstacks to look through + if (FontStackHasher()(pendingGlyphDependency.first) == fontStack) { + GlyphIDs& pendingGlyphIDs = pendingGlyphDependency.second; + for (auto& newGlyph : newGlyphs) { + const GlyphID& glyphID = newGlyph.first; + optional<Immutable<Glyph>>& glyph = newGlyph.second; + + if (pendingGlyphIDs.erase(glyphID)) { + glyphs.emplace(glyphID, std::move(glyph)); + } + } } } } @@ -282,7 +288,7 @@ void GeometryTileWorker::onImagesAvailable(ImageMap newIconMap, ImageMap newPatt void GeometryTileWorker::requestNewGlyphs(const GlyphDependencies& glyphDependencies) { for (auto& fontDependencies : glyphDependencies) { - auto fontGlyphs = glyphMap.find(fontDependencies.first); + auto fontGlyphs = glyphMap.find(FontStackHasher()(fontDependencies.first)); for (auto glyphID : fontDependencies.second) { if (fontGlyphs == glyphMap.end() || fontGlyphs->second.find(glyphID) == fontGlyphs->second.end()) { pendingGlyphDependencies[fontDependencies.first].insert(glyphID); |