[core] Refactor RenderSource updates

* Eliminate updateBatch in favor of diffing layers and detecting changes to properties upon which layout depends.
* Replace RenderSource::{update,remove,invalidate,reload}Tiles with a single update method
* Replace TilePyramid::{update,remove,invalidate,reload}Tiles with a single update method
* Remove Style& dependency TODO from GeometryTile and TileParameters
This commit is contained in:
John Firebaugh
2017-05-30 13:40:36 -07:00
parent 32589c271c
commit 591af0021b
52 changed files with 494 additions and 432 deletions

View File

@@ -22,8 +22,25 @@ bool RenderAnnotationSource::isLoaded() const {
return tilePyramid.isLoaded();
}
void RenderAnnotationSource::invalidateTiles() {
tilePyramid.invalidateTiles();
void RenderAnnotationSource::update(Immutable<style::Source::Impl> baseImpl_,
const std::vector<Immutable<Layer::Impl>>& layers,
const bool needsRendering,
const bool needsRelayout,
const TileParameters& parameters) {
std::swap(baseImpl, baseImpl_);
enabled = needsRendering;
tilePyramid.update(layers,
needsRendering,
needsRelayout,
parameters,
SourceType::Annotations,
util::tileSize,
{ 0, 22 },
[&] (const OverscaledTileID& tileID) {
return std::make_unique<AnnotationTile>(tileID, parameters);
});
}
void RenderAnnotationSource::startRender(algorithm::ClipIDGenerator& generator, const mat4& projMatrix, const mat4& clipMatrix, const TransformState& transform) {
@@ -39,24 +56,6 @@ std::map<UnwrappedTileID, RenderTile>& RenderAnnotationSource::getRenderTiles()
return tilePyramid.getRenderTiles();
}
void RenderAnnotationSource::updateTiles(const TileParameters& parameters) {
tilePyramid.updateTiles(parameters,
SourceType::Annotations,
util::tileSize,
{ 0, 22 },
[&] (const OverscaledTileID& tileID) {
return std::make_unique<AnnotationTile>(tileID, parameters);
});
}
void RenderAnnotationSource::removeTiles() {
tilePyramid.removeTiles();
}
void RenderAnnotationSource::reloadTiles() {
tilePyramid.reloadTiles();
}
std::unordered_map<std::string, std::vector<Feature>>
RenderAnnotationSource::queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,