This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Fix flickering caused by regression in #7586
It should be safe to invoke GeometryTileWorker::setData multiple times without invoking GeometryTileWorker::setLayers. Therefore GeometryTileWorker::redoLayout() must not consume the layers.
- Loading branch information
1 parent
d827073
commit 73a182a
Showing
13 changed files
with
123 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include <mbgl/tile/tile_observer.hpp> | ||
|
||
using namespace mbgl; | ||
|
||
/** | ||
* An implementation of TileObserver that forwards all methods to dynamically-settable lambas. | ||
*/ | ||
class StubTileObserver : public TileObserver { | ||
public: | ||
void onTileChanged(Tile& tile) override { | ||
if (tileChanged) tileChanged(tile); | ||
} | ||
|
||
void onTileError(Tile& tile, std::exception_ptr error) override { | ||
if (tileError) tileError(tile, error); | ||
} | ||
|
||
std::function<void (Tile&)> tileChanged; | ||
std::function<void (Tile&, std::exception_ptr)> tileError; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include <mbgl/test/util.hpp> | ||
#include <mbgl/test/fake_file_source.hpp> | ||
#include <mbgl/test/stub_tile_observer.hpp> | ||
#include <mbgl/tile/geojson_tile.hpp> | ||
#include <mbgl/tile/tile_loader_impl.hpp> | ||
|
||
#include <mbgl/util/default_thread_pool.hpp> | ||
#include <mbgl/util/run_loop.hpp> | ||
#include <mbgl/map/transform.hpp> | ||
#include <mbgl/style/style.hpp> | ||
#include <mbgl/style/update_parameters.hpp> | ||
#include <mbgl/style/layers/circle_layer.hpp> | ||
#include <mbgl/annotation/annotation_manager.hpp> | ||
|
||
#include <memory> | ||
|
||
using namespace mbgl; | ||
using namespace mbgl::style; | ||
|
||
class GeoJSONTileTest { | ||
public: | ||
FakeFileSource fileSource; | ||
TransformState transformState; | ||
util::RunLoop loop; | ||
ThreadPool threadPool { 1 }; | ||
AnnotationManager annotationManager { 1.0 }; | ||
style::Style style { fileSource, 1.0 }; | ||
Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" }; | ||
|
||
style::UpdateParameters updateParameters { | ||
1.0, | ||
MapDebugOptions(), | ||
transformState, | ||
threadPool, | ||
fileSource, | ||
MapMode::Continuous, | ||
annotationManager, | ||
style | ||
}; | ||
}; | ||
|
||
TEST(GeoJSONTile, Issue7648) { | ||
GeoJSONTileTest test; | ||
GeoJSONTile tile(OverscaledTileID(0, 0, 0), "source", test.updateParameters); | ||
|
||
test.style.addLayer(std::make_unique<CircleLayer>("circle", "source")); | ||
|
||
StubTileObserver observer; | ||
observer.tileChanged = [&] (const Tile&) { | ||
// Once present, the bucket should never "disappear", which would cause | ||
// flickering. | ||
ASSERT_NE(nullptr, tile.getBucket(*test.style.getLayer("circle"))); | ||
}; | ||
tile.setObserver(&observer); | ||
|
||
tile.setPlacementConfig({}); | ||
|
||
mapbox::geometry::feature_collection<int16_t> features; | ||
features.push_back(mapbox::geometry::feature<int16_t> { | ||
mapbox::geometry::point<int16_t>(0, 0) | ||
}); | ||
|
||
tile.updateData(features); | ||
while (!tile.isComplete()) { | ||
test.loop.runOnce(); | ||
} | ||
|
||
tile.updateData(features); | ||
while (!tile.isComplete()) { | ||
test.loop.runOnce(); | ||
} | ||
} |