summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-10-26 15:20:38 -0700
committerChris Loer <chris.loer@gmail.com>2017-10-31 10:25:57 -0700
commita865929cdaf7aa4f58e3df01da577ac3d5e74ab1 (patch)
treedc2037c0e9f09db5087933116bbe3c4a25854403
parent4531f34fbe39fac79ce21bc691908a0d0eeb9feb (diff)
downloadqtlocation-mapboxgl-a865929cdaf7aa4f58e3df01da577ac3d5e74ab1.tar.gz
Short circuit line label rendering for labels that are fully faded.
[skip ci]
-rw-r--r--src/mbgl/text/placement.cpp10
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) {