summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/geometry_tile_worker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/tile/geometry_tile_worker.cpp')
-rw-r--r--src/mbgl/tile/geometry_tile_worker.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp
index d1d4c9e9b8..d9b720d226 100644
--- a/src/mbgl/tile/geometry_tile_worker.cpp
+++ b/src/mbgl/tile/geometry_tile_worker.cpp
@@ -196,32 +196,23 @@ void GeometryTileWorker::coalesce() {
self.invoke(&GeometryTileWorker::coalesced);
}
+void GeometryTileWorker::onGlyphsAvailable(GlyphPositionMap newGlyphPositions) {
+ for (auto& newFontGlyphs : newGlyphPositions) {
+ const FontStack& fontStack = newFontGlyphs.first;
+ GlyphPositions& newPositions = newFontGlyphs.second;
-void GeometryTileWorker::onGlyphsAvailable(GlyphPositionMap newGlyphPositions, GlyphRangeSet loadedRanges) {
- GlyphDependencies loadedGlyphs;
- for (auto& pendingFontGlyphs : pendingGlyphDependencies) {
- auto newFontGlyphs = newGlyphPositions.find(pendingFontGlyphs.first);
- for (auto glyphID : pendingFontGlyphs.second) {
- if (newFontGlyphs != newGlyphPositions.end()) {
- auto newFontGlyph = newFontGlyphs->second.find(glyphID);
- if (newFontGlyph != newFontGlyphs->second.end()) {
- glyphPositions[pendingFontGlyphs.first].emplace(glyphID, newFontGlyph->second);
- }
- }
- if (loadedRanges.find(getGlyphRange(glyphID)) != loadedRanges.end()) {
- // Erase the glyph from our pending font set as long as its range is loaded
- // If the glyph itself is missing, that means we can't get a glyph for
- // this fontstack, and we go ahead and render with missing glyphs
- loadedGlyphs[pendingFontGlyphs.first].insert(glyphID);
+ GlyphPositions& positions = glyphPositions[fontStack];
+ GlyphIDs& pendingGlyphIDs = pendingGlyphDependencies[fontStack];
+
+ for (auto& newPosition : newPositions) {
+ const GlyphID& glyphID = newPosition.first;
+ optional<Glyph>& glyph = newPosition.second;
+
+ if (pendingGlyphIDs.erase(glyphID)) {
+ positions.emplace(glyphID, std::move(glyph));
}
}
}
-
- for (auto& loadedFont : loadedGlyphs) {
- for (auto loadedGlyph : loadedFont.second) {
- pendingGlyphDependencies[loadedFont.first].erase(loadedGlyph);
- }
- }
symbolDependenciesChanged();
}