diff options
-rw-r--r-- | platform/android/src/android_renderer_frontend.cpp | 5 | ||||
-rw-r--r-- | platform/android/src/android_renderer_frontend.hpp | 4 | ||||
-rwxr-xr-x | platform/android/src/native_map_view.cpp | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/platform/android/src/android_renderer_frontend.cpp b/platform/android/src/android_renderer_frontend.cpp index acb1c74557..41e44d297a 100644 --- a/platform/android/src/android_renderer_frontend.cpp +++ b/platform/android/src/android_renderer_frontend.cpp @@ -1,6 +1,7 @@ #include "android_renderer_frontend.hpp" #include <mbgl/map/view.hpp> +#include <mbgl/renderer/backend_scope.hpp> #include <mbgl/renderer/renderer.hpp> namespace mbgl { @@ -8,8 +9,10 @@ namespace android { AndroidRendererFrontend::AndroidRendererFrontend( std::unique_ptr<Renderer> renderer_, + RendererBackend& backend_, InvalidateCallback invalidate) : renderer(std::move(renderer_)) + , backend(backend_) , asyncInvalidate([=, invalidate=std::move(invalidate)]() { invalidate(); }) { @@ -38,6 +41,8 @@ void AndroidRendererFrontend::render(View& view) { assert (renderer); if (!updateParameters) return; + BackendScope guard { backend }; + renderer->render(view, *updateParameters); } diff --git a/platform/android/src/android_renderer_frontend.hpp b/platform/android/src/android_renderer_frontend.hpp index 95513a7682..59ece88f19 100644 --- a/platform/android/src/android_renderer_frontend.hpp +++ b/platform/android/src/android_renderer_frontend.hpp @@ -2,6 +2,7 @@ #pragma once #include <mbgl/annotation/annotation.hpp> +#include <mbgl/renderer/renderer_backend.hpp> #include <mbgl/renderer/renderer_frontend.hpp> #include <mbgl/util/async_task.hpp> #include <mbgl/util/geo.hpp> @@ -23,7 +24,7 @@ namespace android { class AndroidRendererFrontend : public RendererFrontend { public: using InvalidateCallback = std::function<void ()>; - AndroidRendererFrontend(std::unique_ptr<Renderer>, InvalidateCallback); + AndroidRendererFrontend(std::unique_ptr<Renderer>, RendererBackend&, InvalidateCallback); ~AndroidRendererFrontend() override; void reset() override; @@ -43,6 +44,7 @@ public: private: std::unique_ptr<Renderer> renderer; + RendererBackend& backend; std::shared_ptr<UpdateParameters> updateParameters; util::AsyncTask asyncInvalidate; }; diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 5f89217485..17f55d9827 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -78,6 +78,7 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env, // Create a renderer frontend rendererFrontend = std::make_unique<AndroidRendererFrontend>(std::move(renderer), + *this, [this] { this->invalidate(); }); // Create the core map |