Reset tileset-based render sources when any tileset properties changed. (#11042)

This commit is contained in:
Asheem Mamoowala
2018-02-05 19:31:03 -05:00
committed by GitHub
parent 90f29a9172
commit 671dfefc1e
6 changed files with 27 additions and 24 deletions

View File

@@ -32,14 +32,10 @@ void RenderRasterDEMSource::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 RenderRasterDEMSource::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,

View File

@@ -40,7 +40,7 @@ private:
const style::RasterSource::Impl& impl() const;
TilePyramid tilePyramid;
optional<std::vector<std::string>> tileURLTemplates;
optional<Tileset> tileset;
protected:
void onTileChanged(Tile&) final;

View File

@@ -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,

View File

@@ -40,7 +40,7 @@ private:
const style::RasterSource::Impl& impl() const;
TilePyramid tilePyramid;
optional<std::vector<std::string>> tileURLTemplates;
optional<Tileset> tileset;
};
template <>

View File

@@ -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,

View File

@@ -40,7 +40,7 @@ private:
const style::VectorSource::Impl& impl() const;
TilePyramid tilePyramid;
optional<std::vector<std::string>> tileURLTemplates;
optional<Tileset> tileset;
};
template <>