diff options
author | Chris Loer <chris.loer@gmail.com> | 2017-10-26 15:20:38 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@gmail.com> | 2017-10-26 15:43:23 -0700 |
commit | b3d3efe56bb5ff4b1860621df5ec5b92bdfeac3b (patch) | |
tree | 561b75bb935af3a0d6484516be1ef2bbf424d681 | |
parent | 2b6ba7ea9e6d992092484385bce8357ad049d1d5 (diff) | |
download | qtlocation-mapboxgl-b3d3efe56bb5ff4b1860621df5ec5b92bdfeac3b.tar.gz |
Short circuit line label rendering for labels that are fully faded.
[skip ci]
-rw-r--r-- | src/mbgl/text/placement.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index b63fcf51b9..39c4a9c79e 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -211,14 +211,16 @@ void Placement::updateBucketOpacities(SymbolBucket& bucket) { // 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) { - // TODO mark PlacedSymbols as hidden so that they don't need to be projected at render time auto opacityVertex = SymbolOpacityAttributes::vertex(opacityState.text.placed, opacityState.text.opacity); for (size_t i = 0; i < symbolInstance.glyphQuads.size() * 4; i++) { bucket.text.opacityVertices.emplace_back(opacityVertex); } + // TODO On JS we avoid setting this if it hasn't chnaged, but it may be cheap enough here we don't care + for (auto index : symbolInstance.placedTextIndices) { + bucket.text.placedSymbols[index].hidden = opacityState.isHidden(); + } } if (symbolInstance.hasIcon) { - // TODO mark PlacedSymbols as hidden so that they don't need to be projected at render time auto opacityVertex = SymbolOpacityAttributes::vertex(opacityState.icon.placed, opacityState.icon.opacity); if (symbolInstance.iconQuad) { bucket.icon.opacityVertices.emplace_back(opacityVertex); @@ -226,6 +228,10 @@ void Placement::updateBucketOpacities(SymbolBucket& bucket) { bucket.icon.opacityVertices.emplace_back(opacityVertex); bucket.icon.opacityVertices.emplace_back(opacityVertex); } + // TODO On JS we avoid setting this if it hasn't chnaged, but it may be cheap enough here we don't care + for (auto index : symbolInstance.placedIconIndices) { + bucket.icon.placedSymbols[index].hidden = opacityState.isHidden(); + } } auto updateCollisionBox = [&](const auto& feature, const bool placed) { |