diff options
author | Ansis Brammanis <ansis@mapbox.com> | 2017-11-03 16:57:19 -0400 |
---|---|---|
committer | Ansis Brammanis <ansis@mapbox.com> | 2017-11-03 16:57:19 -0400 |
commit | 02d8bb6ccd75467dd1a55f36971ea8d6515e2b29 (patch) | |
tree | a0625e534d8430d374ac866688088dbd5bfd55eb | |
parent | e0daf69fdad227e675fd981bdf93c77e94512bfc (diff) | |
download | qtlocation-mapboxgl-upstream/start-collision-tile-bounds.tar.gz |
only render one version of each symbolupstream/start-collision-tile-bounds
-rw-r--r-- | src/mbgl/text/placement.cpp | 11 | ||||
-rw-r--r-- | src/mbgl/text/placement.hpp | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 7076a8b6da..8ab6bd8efb 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -191,6 +191,7 @@ bool Placement::commit(const Placement& prevPlacement, TimePoint now) { } void Placement::updateLayerOpacities(RenderSymbolLayer& symbolLayer) { + std::unordered_set<uint32_t> seenCrossTileIDs; for (RenderTile& renderTile : symbolLayer.renderTiles) { if (!renderTile.tile.isRenderable()) { continue; @@ -199,11 +200,11 @@ void Placement::updateLayerOpacities(RenderSymbolLayer& symbolLayer) { auto bucket = renderTile.tile.getBucket(*symbolLayer.baseImpl); assert(dynamic_cast<SymbolBucket*>(bucket)); SymbolBucket& symbolBucket = *reinterpret_cast<SymbolBucket*>(bucket); - updateBucketOpacities(symbolBucket); + updateBucketOpacities(symbolBucket, seenCrossTileIDs); } } -void Placement::updateBucketOpacities(SymbolBucket& bucket) { +void Placement::updateBucketOpacities(SymbolBucket& bucket, std::unordered_set<uint32_t>& seenCrossTileIDs) { // TODO check if this clear is necessary, whether the vector has been moved out if (bucket.hasTextData()) bucket.text.opacityVertices.clear(); if (bucket.hasIconData()) bucket.icon.opacityVertices.clear(); @@ -211,7 +212,11 @@ void Placement::updateBucketOpacities(SymbolBucket& bucket) { if (bucket.hasCollisionCircleData()) bucket.collisionCircle.opacityVertices.clear(); for (SymbolInstance& symbolInstance : bucket.symbolInstances) { - auto opacityState = getOpacity(symbolInstance.crossTileID); + auto opacityState = seenCrossTileIDs.count(symbolInstance.crossTileID) == 0 ? + getOpacity(symbolInstance.crossTileID) : + JointOpacityState(false, false); + + seenCrossTileIDs.insert(symbolInstance.crossTileID); // TODO check if hasText is the right thing here, or if there are cases where hasText is true but it's not added to the buffers if (symbolInstance.hasText) { diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp index 8d51d86ce7..0aaf104dff 100644 --- a/src/mbgl/text/placement.hpp +++ b/src/mbgl/text/placement.hpp @@ -65,7 +65,7 @@ namespace mbgl { const bool showCollisionBoxes, std::unordered_set<uint32_t>& seenCrossTileIDs); - void updateBucketOpacities(SymbolBucket&); + void updateBucketOpacities(SymbolBucket&, std::unordered_set<uint32_t>&); TransformState state; MapMode mapMode; |