From 806da5d940aed7021f921ab98b9ae8e4e364f732 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 4 May 2017 15:18:49 +0300 Subject: [PATCH] [Qt] Don't regen BackendScope on every QMapboxGL::render() call --- platform/qt/src/qmapboxgl.cpp | 4 +++- platform/qt/src/qmapboxgl_p.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index edb8afa28..1f4ad3b45 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1510,7 +1510,9 @@ void QMapboxGL::render() #endif // The OpenGL implementation automatically enables the OpenGL context for us. - mbgl::BackendScope scope { *d_ptr, mbgl::BackendScope::ScopeType::Implicit }; + if (!d_ptr->backendScope) { + d_ptr->backendScope = std::make_unique(*d_ptr, mbgl::BackendScope::ScopeType::Implicit); + } d_ptr->dirty = false; d_ptr->mapObj->render(*d_ptr); diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp index 49a7942cc..91b2ab752 100644 --- a/platform/qt/src/qmapboxgl_p.hpp +++ b/platform/qt/src/qmapboxgl_p.hpp @@ -55,6 +55,7 @@ public: std::unique_ptr fileSourceObj; std::shared_ptr threadPool; std::unique_ptr mapObj; + std::unique_ptr backendScope; bool dirty { false };