[core] Add Snapshotter::cancel method
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user