summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-07-25 11:04:18 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-07-25 17:44:28 +0300
commit8fef2b65319e2fe896ab5276ab7be97a9ff51798 (patch)
treeadd4452b0cef22d2a9af8b5f244f24017a808a23
parente75fdf10758d0a3dc419e3fa4edafafea904a96d (diff)
downloadqtlocation-mapboxgl-8fef2b65319e2fe896ab5276ab7be97a9ff51798.tar.gz
[android] manage backendscope in renderer frontend
-rw-r--r--platform/android/src/android_renderer_frontend.cpp5
-rw-r--r--platform/android/src/android_renderer_frontend.hpp4
-rwxr-xr-xplatform/android/src/native_map_view.cpp1
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