diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-02-27 16:42:57 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-03-05 17:43:37 +0200 |
commit | 174f40dee3bd2c3c3360e4e5e506f99a4ed35b89 (patch) | |
tree | 4143360451a48339807fe78115186f04d0e9f5ae /platform/default | |
parent | 1577a6b53764e3093b31969cc69de41c7ebf2978 (diff) | |
download | qtlocation-mapboxgl-174f40dee3bd2c3c3360e4e5e506f99a4ed35b89.tar.gz |
[core] Add Snapshotter::cancel method
Diffstat (limited to 'platform/default')
-rw-r--r-- | platform/default/include/mbgl/map/map_snapshotter.hpp | 1 | ||||
-rw-r--r-- | platform/default/src/mbgl/map/map_snapshotter.cpp | 13 |
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 |