diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-03-16 14:26:47 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-03-16 14:26:47 +0200 |
commit | 841415098e9e02e74b6195fd77a4eea7ffc92e87 (patch) | |
tree | 21d4b249820927026d643439f699b6df692c6b67 | |
parent | 14f19f0201a371dc6cf8ddee4b8f0c73bdc5be5d (diff) | |
download | qtlocation-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.cpp | 11 |
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(); } |