summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-06-03 15:33:22 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-06-03 17:03:57 +0300
commita44b7f1e5ddae61260e55db5b68b10d9aa5e711d (patch)
treeb083e37281341dd3d78f4976ba07922036294595 /src
parent1fa8e763d9c620d9fa2fa49124bc0517e18c673c (diff)
downloadqtlocation-mapboxgl-a44b7f1e5ddae61260e55db5b68b10d9aa5e711d.tar.gz
[core] Avoid unneeded update of symbol dynamic vertex buffer
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.cpp9
-rw-r--r--src/mbgl/text/placement.cpp12
-rw-r--r--src/mbgl/text/placement.hpp4
3 files changed, 18 insertions, 7 deletions
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp
index fe083cca9e..c9dd126181 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.cpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp
@@ -257,10 +257,13 @@ void SymbolBucket::updateVertices(Placement& placement, bool updateOpacities, co
if (updateOpacities) {
placement.updateBucketOpacities(*this, seenIds);
placementChangesUploaded = false;
+ uploaded = false;
+ }
+
+ if (placement.updateBucketDynamicVertices(*this, tile)) {
+ dynamicUploaded = false;
+ uploaded = false;
}
- placement.updateBucketDynamicVertices(*this, tile);
- dynamicUploaded = false;
- uploaded = false;
}
} // namespace mbgl
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index c95df02a41..452a071683 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -402,17 +402,20 @@ Point<float> calculateVariableRenderShift(style::SymbolAnchorType anchor, float
}
} // namespace
-void Placement::updateBucketDynamicVertices(SymbolBucket& bucket, const RenderTile& tile) {
+bool Placement::updateBucketDynamicVertices(SymbolBucket& bucket, const RenderTile& tile) {
using namespace style;
const auto& layout = bucket.layout;
const bool alongLine = layout.get<SymbolPlacement>() != SymbolPlacementType::Point;
+ bool result = false;
+
if (alongLine) {
- if (bucket.hasIconData() && layout.get<IconRotationAlignment>() == AlignmentType::Map) {
+ if (bucket.hasIconData() && layout.get<IconRotationAlignment>() == AlignmentType::Map) {
const bool pitchWithMap = layout.get<style::IconPitchAlignment>() == style::AlignmentType::Map;
const bool keepUpright = layout.get<style::IconKeepUpright>();
reprojectLineLabels(bucket.icon.dynamicVertices, bucket.icon.placedSymbols,
tile.matrix, pitchWithMap, true /*rotateWithMap*/, keepUpright,
tile, *bucket.iconSizeBinder, state);
+ result = true;
}
if (bucket.hasTextData() && layout.get<TextRotationAlignment>() == AlignmentType::Map) {
@@ -421,6 +424,7 @@ void Placement::updateBucketDynamicVertices(SymbolBucket& bucket, const RenderTi
reprojectLineLabels(bucket.text.dynamicVertices, bucket.text.placedSymbols,
tile.matrix, pitchWithMap, true /*rotateWithMap*/, keepUpright,
tile, *bucket.textSizeBinder, state);
+ result = true;
}
} else if (!layout.get<TextVariableAnchor>().empty() && bucket.hasTextData()) {
bucket.text.dynamicVertices.clear();
@@ -488,7 +492,11 @@ void Placement::updateBucketDynamicVertices(SymbolBucket& bucket, const RenderTi
}
}
}
+
+ result = true;
}
+
+ return result;
}
void Placement::updateBucketOpacities(SymbolBucket& bucket, std::set<uint32_t>& seenCrossTileIDs) {
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp
index a568b6985f..69d05c94db 100644
--- a/src/mbgl/text/placement.hpp
+++ b/src/mbgl/text/placement.hpp
@@ -118,8 +118,8 @@ private:
SymbolBucket&,
const BucketPlacementParameters&,
std::set<uint32_t>& seenCrossTileIDs);
-
- void updateBucketDynamicVertices(SymbolBucket& bucket, const RenderTile& tile);
+ // Returns `true` if bucket vertices were updated; returns `false` otherwise.
+ bool updateBucketDynamicVertices(SymbolBucket& bucket, const RenderTile& tile);
void updateBucketOpacities(SymbolBucket&, std::set<uint32_t>&);
void markUsedJustification(SymbolBucket&, style::TextVariableAnchorType, SymbolInstance&);