diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-11-26 03:15:20 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-11-26 16:35:17 +0200 |
commit | b6fbd1221e4185ff84f7353a7acb1948e2298bd6 (patch) | |
tree | b7347719437c23e08e2525734bfcdf0989dd43f8 /src/mbgl/renderer/sources/render_geojson_source.cpp | |
parent | 0f3eede6a6d10a8e2669ffed967cacdb8def79bf (diff) | |
download | qtlocation-mapboxgl-b6fbd1221e4185ff84f7353a7acb1948e2298bd6.tar.gz |
[core] Clear tiles when GeoJSON data changes
In tile and static mode clear tiles when data changes
in order to avoid render tests being flaky.
Diffstat (limited to 'src/mbgl/renderer/sources/render_geojson_source.cpp')
-rw-r--r-- | src/mbgl/renderer/sources/render_geojson_source.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/mbgl/renderer/sources/render_geojson_source.cpp b/src/mbgl/renderer/sources/render_geojson_source.cpp index 67b4c48d9b..4ed9dd9334 100644 --- a/src/mbgl/renderer/sources/render_geojson_source.cpp +++ b/src/mbgl/renderer/sources/render_geojson_source.cpp @@ -85,27 +85,25 @@ void RenderGeoJSONSource::update(Immutable<style::Source::Impl> baseImpl_, enabled = needsRendering; auto data_ = impl().getData().lock(); - if (!data_) { - // In Continuous mode, keep the existing tiles if the new data_ 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. - if (parameters.mode != MapMode::Continuous) tilePyramid.clearAll(); - return; - } - if (data.lock() != data_) { data = data_; - tilePyramid.reduceMemoryUse(); - const uint8_t maxZ = impl().getZoomRange().max; - for (const auto& pair : tilePyramid.getTiles()) { - if (pair.first.canonical.z <= maxZ) { - static_cast<GeoJSONTile*>(pair.second.get()) - ->updateData(data_->getTile(pair.first.canonical), needsRelayout); + if (parameters.mode != MapMode::Continuous) { + // Clearing the tile pyramid in order to avoid render tests being flaky. + tilePyramid.clearAll(); + } else if (data_) { + tilePyramid.reduceMemoryUse(); + const uint8_t maxZ = impl().getZoomRange().max; + for (const auto& pair : tilePyramid.getTiles()) { + if (pair.first.canonical.z <= maxZ) { + static_cast<GeoJSONTile*>(pair.second.get()) + ->updateData(data_->getTile(pair.first.canonical), needsRelayout); + } } } } + if (!data_) return; + tilePyramid.update(layers, needsRendering, needsRelayout, |