diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-06 09:20:07 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-14 15:39:31 -0700 |
commit | a50d7a331bccd5ef35f08d8d0e24a0348510eb5a (patch) | |
tree | ac174cebebefa07a4f90263b57aaa47747bf1ef8 /src/mbgl/tile/geometry_tile_worker.cpp | |
parent | 09a22715769c629ad433b405908b60e1b9fa969b (diff) | |
download | qtlocation-mapboxgl-a50d7a331bccd5ef35f08d8d0e24a0348510eb5a.tar.gz |
[core] Replace GlyphRangeSet in onGlyphsAvailable with optionals in the map
GlyphRangeSet isn't keyed by FontStack, so using it to indicate that a particular range was loaded could have produced false positives.
Diffstat (limited to 'src/mbgl/tile/geometry_tile_worker.cpp')
-rw-r--r-- | src/mbgl/tile/geometry_tile_worker.cpp | 35 |
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(); } |