From 971807d3b09892dbb6901461d1ce9adb3552a22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 23 May 2016 13:35:07 +0200 Subject: [core] move parsePending() call to TileData --- src/mbgl/style/source.cpp | 1 - src/mbgl/tile/geometry_tile_data.cpp | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mbgl/style/source.cpp b/src/mbgl/style/source.cpp index a31c804b01..10959a9fd8 100644 --- a/src/mbgl/style/source.cpp +++ b/src/mbgl/style/source.cpp @@ -406,7 +406,6 @@ void Source::setObserver(SourceObserver* observer_) { } void Source::onTileLoaded(TileData& tileData, bool isNewTile) { - tileData.redoPlacement(); observer->onTileLoaded(*this, tileData.id, isNewTile); } diff --git a/src/mbgl/tile/geometry_tile_data.cpp b/src/mbgl/tile/geometry_tile_data.cpp index d367fa4d07..aefd327ff0 100644 --- a/src/mbgl/tile/geometry_tile_data.cpp +++ b/src/mbgl/tile/geometry_tile_data.cpp @@ -46,6 +46,7 @@ void GeometryTileData::setData(std::exception_ptr err, workRequest.reset(); availableData = DataAvailability::All; buckets.clear(); + redoPlacement(); observer->onTileLoaded(*this, true); return; } @@ -80,6 +81,7 @@ void GeometryTileData::setData(std::exception_ptr err, geometryTile = std::move(resultBuckets.geometryTile); } + redoPlacement(); observer->onTileLoaded(*this, true); } else { availableData = DataAvailability::All; @@ -121,6 +123,7 @@ bool GeometryTileData::parsePending() { geometryTile = std::move(resultBuckets.geometryTile); } + redoPlacement(); observer->onTileLoaded(*this, false); } else { availableData = DataAvailability::All; @@ -142,17 +145,16 @@ Bucket* GeometryTileData::getBucket(const style::Layer& layer) { } void GeometryTileData::redoPlacement(const PlacementConfig newConfig) { - if (newConfig != placedConfig) { - targetConfig = newConfig; - - redoPlacement(); - } + targetConfig = newConfig; + redoPlacement(); } void GeometryTileData::redoPlacement() { // Don't start a new placement request when the current one hasn't completed yet, or when // we are parsing buckets. - if (workRequest) return; + if (workRequest || targetConfig == placedConfig) { + return; + } workRequest = worker.redoPlacement(tileWorker, buckets, targetConfig, [this, config = targetConfig](std::unique_ptr collisionTile) { workRequest.reset(); -- cgit v1.2.1