diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 77227361007..d1a04032838 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -6,6 +6,7 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to ### Bug fixes - Fixed the rendering bug caused by redundant pending requests for already requested images [#15864](https://github.com/mapbox/mapbox-gl-native/pull/15864) + - Fixed Geo JSON source flickering on style transition [#15907](https://github.com/mapbox/mapbox-gl-native/pull/15907) ### Performance improvements - Enable incremental vacuum for the offline database in order to make data removal requests faster and to avoid the excessive disk space usage (creating a backup file on VACUUM call) [#15837](https://github.com/mapbox/mapbox-gl-native/pull/15837) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 98761737f73..6e555492d9a 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -9,6 +9,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ### Bug fixes * Fixed the rendering bug caused by redundant pending requests for already requested images [#15864](https://github.com/mapbox/mapbox-gl-native/pull/15864) * Enable incremental vacuum for the offline database in order to make data removal requests faster and to avoid the excessive disk space usage (creating a backup file on VACUUM call). ([#15837](https://github.com/mapbox/mapbox-gl-native/pull/15837)) +* Fixed Geo JSON source flickering on style transition. ([#15907](https://github.com/mapbox/mapbox-gl-native/pull/15907)) ## 5.5.0 diff --git a/src/mbgl/renderer/sources/render_geojson_source.cpp b/src/mbgl/renderer/sources/render_geojson_source.cpp index 035244e3717..67b4c48d9b7 100644 --- a/src/mbgl/renderer/sources/render_geojson_source.cpp +++ b/src/mbgl/renderer/sources/render_geojson_source.cpp @@ -85,26 +85,27 @@ void RenderGeoJSONSource::update(Immutable 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(); - - if (data_) { - const uint8_t maxZ = impl().getZoomRange().max; - for (const auto& pair : tilePyramid.getTiles()) { - if (pair.first.canonical.z <= maxZ) { - static_cast(pair.second.get())->updateData(data_->getTile(pair.first.canonical), needsRelayout); - } + const uint8_t maxZ = impl().getZoomRange().max; + for (const auto& pair : tilePyramid.getTiles()) { + if (pair.first.canonical.z <= maxZ) { + static_cast(pair.second.get()) + ->updateData(data_->getTile(pair.first.canonical), needsRelayout); } } } - if (!data_) { - tilePyramid.clearAll(); - return; - } - tilePyramid.update(layers, needsRendering, needsRelayout,