summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-03-16 14:26:47 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-03-16 14:26:47 +0200
commit841415098e9e02e74b6195fd77a4eea7ffc92e87 (patch)
tree21d4b249820927026d643439f699b6df692c6b67
parent14f19f0201a371dc6cf8ddee4b8f0c73bdc5be5d (diff)
downloadqtlocation-mapboxgl-upstream/mikahil_stricter_tile_caching_for_tile_mode.tar.gz
[core][tile mode] Always clear tile pyramid in RenderTileSetSource::update()upstream/mikahil_stricter_tile_caching_for_tile_mode
In `Tile` and `Static` map mode we make sure that outdated tiles are never shown.
-rw-r--r--src/mbgl/renderer/sources/render_tile_source.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mbgl/renderer/sources/render_tile_source.cpp b/src/mbgl/renderer/sources/render_tile_source.cpp
index 221f976c50..12825fd867 100644
--- a/src/mbgl/renderer/sources/render_tile_source.cpp
+++ b/src/mbgl/renderer/sources/render_tile_source.cpp
@@ -182,13 +182,14 @@ void RenderTileSetSource::update(Immutable<style::Source::Impl> baseImpl_,
const optional<Tileset>& implTileset = getTileset();
// In Continuous mode, keep the existing tiles if the new cachedTileset is not
// yet available, thus providing smart style transitions without flickering.
- // In other modes, allow clearing the tile pyramid first, before the early
- // return in order to avoid render tests being flaky.
- bool canUpdateTileset = implTileset || parameters.mode != MapMode::Continuous;
- if (canUpdateTileset && cachedTileset != implTileset) {
+ //
+ // In other modes, always clearing the tile pyramid first, before the early
+ // return in order to make sure the stale tiles are not shown.
+ bool updatedTileset = implTileset && cachedTileset != implTileset;
+ if (updatedTileset || parameters.mode != MapMode::Continuous) {
cachedTileset = implTileset;
- // TODO: this removes existing buckets, and will cause flickering.
+ // TODO: this removes existing buckets, and will cause flickering in Continuous mode.
// Should instead refresh tile data in place.
tilePyramid.clearAll();
}