Handle the case where styles update without a bucket change, fixing `… (#1874)

This commit is contained in:
Tim Sylvester
2023-11-17 09:44:00 -08:00
committed by GitHub
parent b01c6270d4
commit 4150c8b851
9 changed files with 97 additions and 62 deletions

View File

@@ -166,6 +166,30 @@ const LayerRenderData* RenderLayer::getRenderDataForPass(const RenderTile& tile,
}
#if MLN_DRAWABLE_RENDERER
bool RenderLayer::updateTile(RenderPass renderPass,
const OverscaledTileID& tileID,
std::function<bool(gfx::Drawable&)> update) {
bool anyUpdated = false;
if (const auto tileGroup = static_cast<TileLayerGroup*>(layerGroup.get())) {
bool unUpdatedDrawables = false;
tileGroup->visitDrawables(renderPass, tileID, [&](gfx::Drawable& drawable) {
if (update(drawable)) {
anyUpdated = true;
} else {
unUpdatedDrawables = true;
}
});
// If any are updated, the caller shouldn't add new ones.
// If none are updated and some were skipped, remove those.
// This is to handle the case that the style layer changes but the bucket is not re-created.
if (!anyUpdated && unUpdatedDrawables) {
removeTile(renderPass, tileID);
}
}
return anyUpdated;
}
std::size_t RenderLayer::removeTile(RenderPass renderPass, const OverscaledTileID& tileID) {
if (const auto tileGroup = static_cast<TileLayerGroup*>(layerGroup.get())) {
const auto n = tileGroup->removeDrawables(renderPass, tileID).size();