summaryrefslogtreecommitdiff
path: root/src/mbgl/map/map_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/map/map_impl.cpp')
-rw-r--r--src/mbgl/map/map_impl.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp
index ecb9238362..0edf26e262 100644
--- a/src/mbgl/map/map_impl.cpp
+++ b/src/mbgl/map/map_impl.cpp
@@ -172,8 +172,19 @@ void Map::Impl::jumpTo(const CameraOptions& camera) {
onUpdate();
}
-void Map::Impl::onStyleImageMissing(const std::string& id) {
- observer.onStyleImageMissing(id);
+void Map::Impl::onStyleImageMissing(const std::string& id, std::function<void()> done) {
+
+ if (style->getImage(id) != nullptr) {
+ done();
+ return;
+ }
+
+ observer.onStyleImageMissing(id, [this, done](optional<std::unique_ptr<mbgl::style::Image>> image = {}) {
+ if (image) {
+ style->addImage(std::move(*image));
+ }
+ done();
+ });
}
} // namespace mbgl