[core] Add Snapshotter::cancel method

This commit is contained in:
Alexander Shalamov
2020-02-27 16:42:57 +02:00
parent 1577a6b537
commit 174f40dee3
2 changed files with 10 additions and 4 deletions

View File

@@ -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;

View File

@@ -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