summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp23
-rw-r--r--src/mbgl/text/placement.cpp3
-rw-r--r--src/mbgl/text/placement.hpp3
3 files changed, 22 insertions, 7 deletions
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index d96215a550..57135fb1fb 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -373,15 +373,26 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
}
}
- auto newPlacement = std::make_unique<Placement>(parameters.state, parameters.mapMode);
- for (auto it = order.rbegin(); it != order.rend(); ++it) {
- if (it->layer.is<RenderSymbolLayer>()) {
- newPlacement->placeLayer(*it->layer.as<RenderSymbolLayer>(), parameters.projMatrix, parameters.debugOptions & MapDebugOptions::Collision);
+ bool placementChanged = false;
+ if (placement->recentUntil <= parameters.timePoint || updateParameters.mode == MapMode::Still) {
+ auto newPlacement = std::make_unique<Placement>(parameters.state, parameters.mapMode);
+ for (auto it = order.rbegin(); it != order.rend(); ++it) {
+ if (it->layer.is<RenderSymbolLayer>()) {
+ newPlacement->placeLayer(*it->layer.as<RenderSymbolLayer>(), parameters.projMatrix, parameters.debugOptions & MapDebugOptions::Collision);
+ }
}
+
+ placementChanged = newPlacement->commit(*placement, parameters.timePoint);
+ if (placementChanged) {
+ placement = std::move(newPlacement);
+ }
+
+ placement->stale = false;
+ placement->recentUntil = parameters.timePoint + Duration(std::chrono::milliseconds(300));
+ } else {
+ placement->stale = true;
}
- const bool placementChanged = newPlacement->commit(*placement, parameters.timePoint);
- if (placementChanged) placement = std::move(newPlacement);
parameters.symbolFadeChange = placement->symbolFadeChange(parameters.timePoint);
if (placementChanged || symbolBucketsChanged) {
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index 9a9456db2f..b7de01623f 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -32,6 +32,7 @@ bool JointOpacityState::isHidden() const {
Placement::Placement(const TransformState& state_, MapMode mapMode_)
: collisionIndex(state_)
+ , recentUntil(TimePoint::min())
, state(state_)
, mapMode(mapMode_)
{}
@@ -290,7 +291,7 @@ float Placement::symbolFadeChange(TimePoint now) const {
}
bool Placement::hasTransitions(TimePoint now) const {
- return symbolFadeChange(now) < 1.0;
+ return symbolFadeChange(now) < 1.0 || stale;
}
} // namespace mbgl
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp
index 2902192b52..8d51d86ce7 100644
--- a/src/mbgl/text/placement.hpp
+++ b/src/mbgl/text/placement.hpp
@@ -50,6 +50,9 @@ namespace mbgl {
// TODO: public for queryRenderedFeatures
CollisionIndex collisionIndex;
+ TimePoint recentUntil;
+ bool stale = false;
+
private:
void placeLayerBucket(