summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-27 16:42:57 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-03-04 22:54:21 +0200
commit0488de5f0ea61b6464277839f95a5b5a028249b0 (patch)
tree4ddfca1902bcd7951afa61a7b036453267f37a49
parent55f6cb110bd30c3b8d71f2553b48b85b545b9f8c (diff)
downloadqtlocation-mapboxgl-0488de5f0ea61b6464277839f95a5b5a028249b0.tar.gz
[core] Add Snapshotter::cancel method
-rw-r--r--platform/default/include/mbgl/map/map_snapshotter.hpp1
-rw-r--r--platform/default/src/mbgl/map/map_snapshotter.cpp13
2 files changed, 10 insertions, 4 deletions
diff --git a/platform/default/include/mbgl/map/map_snapshotter.hpp b/platform/default/include/mbgl/map/map_snapshotter.hpp
index 2f7a4e6c0c..df5711777d 100644
--- a/platform/default/include/mbgl/map/map_snapshotter.hpp
+++ b/platform/default/include/mbgl/map/map_snapshotter.hpp
@@ -54,6 +54,7 @@ public:
using Attributions = std::vector<std::string>;
using Callback = std::function<void (std::exception_ptr, PremultipliedImage, Attributions, PointForFn, LatLngForFn)>;
void snapshot(Callback);
+ void cancel();
private:
class Impl;
diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp
index 75914e079c..201dd78247 100644
--- a/platform/default/src/mbgl/map/map_snapshotter.cpp
+++ b/platform/default/src/mbgl/map/map_snapshotter.cpp
@@ -232,6 +232,7 @@ public:
Map& getMap() { return map; }
const Map& getMap() const { return map; }
SnapshotterRendererFrontend& getRenderer() { return frontend; }
+ void cancel() { renderStillCallback.reset(); }
private:
std::unique_ptr<Actor<MapSnapshotter::Callback>> renderStillCallback;
@@ -256,10 +257,6 @@ MapSnapshotter::MapSnapshotter(std::pair<bool, std::string> style,
MapSnapshotter::~MapSnapshotter() = default;
-void MapSnapshotter::snapshot(MapSnapshotter::Callback callback) {
- impl->snapshot(std::move(callback));
-}
-
void MapSnapshotter::setStyleURL(const std::string& styleURL) {
impl->getMap().getStyle().loadURL(styleURL);
}
@@ -310,4 +307,12 @@ const style::Style& MapSnapshotter::getStyle() const {
return impl->getMap().getStyle();
}
+void MapSnapshotter::snapshot(MapSnapshotter::Callback callback) {
+ impl->snapshot(std::move(callback));
+}
+
+void MapSnapshotter::cancel() {
+ impl->cancel();
+}
+
} // namespace mbgl