summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/geometry_tile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/tile/geometry_tile.cpp')
-rw-r--r--src/mbgl/tile/geometry_tile.cpp46
1 files changed, 11 insertions, 35 deletions
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp
index 0c8a92d8b7..f95d7220bd 100644
--- a/src/mbgl/tile/geometry_tile.cpp
+++ b/src/mbgl/tile/geometry_tile.cpp
@@ -125,36 +125,17 @@ void GeometryTile::setShowCollisionBoxes(const bool showCollisionBoxes_) {
}
void GeometryTile::onLayout(LayoutResult result, const uint64_t resultCorrelationID) {
- // Don't mark ourselves loaded or renderable until the first successful placement
- // TODO: Ideally we'd render this tile without symbols as long as this tile wasn't
- // replacing a tile at a different zoom that _did_ have symbols.
- (void)resultCorrelationID;
- nonSymbolBuckets = std::move(result.nonSymbolBuckets);
- // It is possible for multiple onLayouts to be called before an onPlacement is called, in which
- // case we will discard previous pending data
- pendingFeatureIndex = {{ false, std::move(result.featureIndex) }};
- pendingData = {{ false, std::move(result.tileData) }};
- observer->onTileChanged(*this);
-}
-
-void GeometryTile::onPlacement(PlacementResult result, const uint64_t resultCorrelationID) {
loaded = true;
renderable = true;
if (resultCorrelationID == correlationID) {
pending = false;
}
+
+ nonSymbolBuckets = std::move(result.nonSymbolBuckets);
symbolBuckets = std::move(result.symbolBuckets);
- // When symbolBuckets arrive, mark pendingData/FeatureIndex as "ready for commit" at the
- // time of the next global placement. We are counting on these symbolBuckets being
- // in sync with the data/index in the last `onLayout` call, even though the correlation IDs
- // may not be the same (e.g. "setShowCollisionBoxes" could bump the correlation ID while
- // waiting for glyph dependencies)
- if (pendingData) {
- pendingData->first = true;
- }
- if (pendingFeatureIndex) {
- pendingFeatureIndex->first = true;
- }
+
+ dataPendingCommit = {{ std::move(result.tileData), std::move(result.featureIndex) }};
+
if (result.glyphAtlasImage) {
glyphAtlasImage = std::move(*result.glyphAtlasImage);
}
@@ -227,17 +208,12 @@ Bucket* GeometryTile::getBucket(const Layer::Impl& layer) const {
}
void GeometryTile::commitFeatureIndex() {
- // We commit our pending FeatureIndex and GeometryTileData when:
- // 1) An `onPlacement` result has delivered us updated symbolBuckets since we received the pending data
- // 2) A global placement has run, synchronizing the global CollisionIndex with the latest
- // symbolBuckets (and thus with the latest FeatureIndex/GeometryTileData)
- if (pendingFeatureIndex && pendingFeatureIndex->first) {
- featureIndex = std::move(pendingFeatureIndex->second);
- pendingFeatureIndex = nullopt;
- }
- if (pendingData && pendingData->first) {
- data = std::move(pendingData->second);
- pendingData = nullopt;
+ // We commit our pending FeatureIndex and GeometryTileData when a global placement has run,
+ // synchronizing the global CollisionIndex with the latest symbolBuckets/FeatureIndex/GeometryTileData
+ if (dataPendingCommit) {
+ data = std::move(dataPendingCommit->first);
+ featureIndex = std::move(dataPendingCommit->second);
+ dataPendingCommit = nullopt;
}
}