summaryrefslogtreecommitdiff
path: root/src/mbgl/tile
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-10-02 17:03:50 -0700
committerChris Loer <chris.loer@mapbox.com>2018-10-15 13:15:46 -0700
commitce76bde13d0f4381ee861f81daf636defaff0bc5 (patch)
treee37d93d14fc64620069bac5488bae871af2fa431 /src/mbgl/tile
parentbc718257748f1ad87658e85f8c31b574afca57a9 (diff)
downloadqtlocation-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.cpp26
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);