Reset tileset-based render sources when any tileset properties changed. (#11042)
This commit is contained in:
@@ -29,14 +29,10 @@ void RenderRasterSource::update(Immutable<style::Source::Impl> baseImpl_,
|
||||
|
||||
enabled = needsRendering;
|
||||
|
||||
optional<Tileset> tileset = impl().getTileset();
|
||||
optional<Tileset> _tileset = impl().getTileset();
|
||||
|
||||
if (!tileset) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tileURLTemplates != tileset->tiles) {
|
||||
tileURLTemplates = tileset->tiles;
|
||||
if (tileset != _tileset) {
|
||||
tileset = _tileset;
|
||||
|
||||
// TODO: this removes existing buckets, and will cause flickering.
|
||||
// Should instead refresh tile data in place.
|
||||
@@ -44,6 +40,11 @@ void RenderRasterSource::update(Immutable<style::Source::Impl> baseImpl_,
|
||||
tilePyramid.renderTiles.clear();
|
||||
tilePyramid.cache.clear();
|
||||
}
|
||||
// Allow clearing the tile pyramid first, before the early return in case
|
||||
// the new tileset is not yet available or has an error in loading
|
||||
if (!_tileset) {
|
||||
return;
|
||||
}
|
||||
|
||||
tilePyramid.update(layers,
|
||||
needsRendering,
|
||||
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
const style::RasterSource::Impl& impl() const;
|
||||
|
||||
TilePyramid tilePyramid;
|
||||
optional<std::vector<std::string>> tileURLTemplates;
|
||||
optional<Tileset> tileset;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -32,14 +32,10 @@ void RenderVectorSource::update(Immutable<style::Source::Impl> baseImpl_,
|
||||
|
||||
enabled = needsRendering;
|
||||
|
||||
optional<Tileset> tileset = impl().getTileset();
|
||||
optional<Tileset> _tileset = impl().getTileset();
|
||||
|
||||
if (!tileset) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tileURLTemplates != tileset->tiles) {
|
||||
tileURLTemplates = tileset->tiles;
|
||||
if (tileset != _tileset) {
|
||||
tileset = _tileset;
|
||||
|
||||
// TODO: this removes existing buckets, and will cause flickering.
|
||||
// Should instead refresh tile data in place.
|
||||
@@ -47,6 +43,11 @@ void RenderVectorSource::update(Immutable<style::Source::Impl> baseImpl_,
|
||||
tilePyramid.renderTiles.clear();
|
||||
tilePyramid.cache.clear();
|
||||
}
|
||||
// Allow clearing the tile pyramid first, before the early return in case
|
||||
// the new tileset is not yet available or has an error in loading
|
||||
if (!_tileset) {
|
||||
return;
|
||||
}
|
||||
|
||||
tilePyramid.update(layers,
|
||||
needsRendering,
|
||||
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
const style::VectorSource::Impl& impl() const;
|
||||
|
||||
TilePyramid tilePyramid;
|
||||
optional<std::vector<std::string>> tileURLTemplates;
|
||||
optional<Tileset> tileset;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
Reference in New Issue
Block a user