summaryrefslogtreecommitdiff
path: root/src/mbgl/map
diff options
context:
space:
mode:
authorAnsis Brammanis <ansis.brammanis@gmail.com>2019-04-02 12:57:45 -0400
committerGitHub <noreply@github.com>2019-04-02 12:57:45 -0400
commit2455275bf47e1671a92eb2c1296c6b48f11f6b2e (patch)
treead027661edc899feae56ad8b50ebd208f7a36d12 /src/mbgl/map
parent805b1402452da74042b995d693c48ee4b79ae337 (diff)
downloadqtlocation-mapboxgl-2455275bf47e1671a92eb2c1296c6b48f11f6b2e.tar.gz
add onStyleImageMissing to allow dynamically loaded or generated images (#14253)
Also make `Style#updateImage(...)` much faster when the image doesn't change size. This can be useful for asynchronously generating images.
Diffstat (limited to 'src/mbgl/map')
-rw-r--r--src/mbgl/map/map_impl.cpp10
-rw-r--r--src/mbgl/map/map_impl.hpp1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp
index 42561cf8bf..1ec7255822 100644
--- a/src/mbgl/map/map_impl.cpp
+++ b/src/mbgl/map/map_impl.cpp
@@ -171,4 +171,14 @@ void Map::Impl::jumpTo(const CameraOptions& camera) {
onUpdate();
}
+void Map::Impl::onStyleImageMissing(const std::string& id, std::function<void()> done) {
+
+ if (style->getImage(id) == nullptr) {
+ observer.onStyleImageMissing(id);
+ }
+
+ done();
+ onUpdate();
+}
+
} // namespace mbgl
diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp
index 7086148276..f233f78275 100644
--- a/src/mbgl/map/map_impl.hpp
+++ b/src/mbgl/map/map_impl.hpp
@@ -47,6 +47,7 @@ public:
void onDidFinishRenderingFrame(RenderMode, bool) final;
void onWillStartRenderingMap() final;
void onDidFinishRenderingMap() final;
+ void onStyleImageMissing(const std::string&, std::function<void()>) final;
// Map
void jumpTo(const CameraOptions&);