diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-05-24 16:12:42 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2020-05-26 20:37:08 +0300 |
commit | ee77b3ab678bb7cfc2f3ab6fe67900784a00ffaf (patch) | |
tree | 759dcfca00b0b8bc7052dcdc6f36053dbc6e606c | |
parent | 374c86942ac4d6b10843468f12803a77876f99c4 (diff) | |
download | qtlocation-mapboxgl-ee77b3ab678bb7cfc2f3ab6fe67900784a00ffaf.tar.gz |
[core] Fix symbol flickering while zooming out
This commit fixes a leftover from `2bf1610e6cb924d1a893c7f3acf4714c78819961`.
During zoom out, the similar symbols from "fading" child tile shall be
handled also in the appearing parent tile to obviate flickering.
-rw-r--r-- | src/mbgl/text/placement.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index f98039decc..ab91291de7 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -239,7 +239,16 @@ void Placement::placeSymbolBucket(const BucketPlacementData& params, std::set<ui collisionGroups.get(params.sourceId), getAvoidEdges(symbolBucket, renderTile.matrix)}; for (const SymbolInstance& symbol : getSortedSymbols(params, ctx.pixelRatio)) { - if (seenCrossTileIDs.count(symbol.crossTileID) != 0u) continue; + if (seenCrossTileIDs.count(symbol.crossTileID) != 0u || + symbol.crossTileID == SymbolInstance::invalidCrossTileID()) + continue; + if (ctx.getRenderTile().holdForFade()) { + const JointPlacement kUnplaced(false, false, false); + // Mark all symbols from this tile as "not placed", but don't add to seenCrossTileIDs, because we don't + // know yet if we have a duplicate in a parent tile that _should_ be placed. + placements.emplace(symbol.crossTileID, kUnplaced); + continue; + } placeSymbol(symbol, ctx); seenCrossTileIDs.insert(symbol.crossTileID); } @@ -253,14 +262,7 @@ void Placement::placeSymbolBucket(const BucketPlacementData& params, std::set<ui } JointPlacement Placement::placeSymbol(const SymbolInstance& symbolInstance, const PlacementContext& ctx) { - static const JointPlacement kUnplaced(false, false, false); - if (symbolInstance.crossTileID == SymbolInstance::invalidCrossTileID()) return kUnplaced; - - if (ctx.getRenderTile().holdForFade()) { - // Mark all symbols from this tile as "not placed", but don't add to seenCrossTileIDs, because we don't - // know yet if we have a duplicate in a parent tile that _should_ be placed. - return kUnplaced; - } + assert(symbolInstance.crossTileID != SymbolInstance::invalidCrossTileID()); const SymbolBucket& bucket = ctx.getBucket(); const mat4& posMatrix = ctx.getRenderTile().matrix; const auto& collisionGroup = ctx.collisionGroup; |