diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-05-04 15:18:49 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-05-04 15:58:30 +0300 |
commit | 806da5d940aed7021f921ab98b9ae8e4e364f732 (patch) | |
tree | 0f4aeea47d8a1b93ab525ff258a4593436880a1b /platform | |
parent | 1b16be409a24ee89c7d608750fb4626fd08e1841 (diff) | |
download | qtlocation-mapboxgl-806da5d940aed7021f921ab98b9ae8e4e364f732.tar.gz |
[Qt] Don't regen BackendScope on every QMapboxGL::render() call
Diffstat (limited to 'platform')
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 4 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl_p.hpp | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index edb8afa28a..1f4ad3b456 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<mbgl::BackendScope>(*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 49a7942cce..91b2ab752e 100644 --- a/platform/qt/src/qmapboxgl_p.hpp +++ b/platform/qt/src/qmapboxgl_p.hpp @@ -55,6 +55,7 @@ public: std::unique_ptr<mbgl::DefaultFileSource> fileSourceObj; std::shared_ptr<mbgl::ThreadPool> threadPool; std::unique_ptr<mbgl::Map> mapObj; + std::unique_ptr<mbgl::BackendScope> backendScope; bool dirty { false }; |