summaryrefslogtreecommitdiff
path: root/platform/qt
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-11-27 17:25:20 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-11-29 15:48:51 +0100
commit2eec5a19803a01e21d5793706ae69ac0d886cee5 (patch)
treefb0f1464f1e73eca49dd062dfd70770e84ec6b8b /platform/qt
parent335f04f7e13422ce53cbbf13cebb8283149faba8 (diff)
downloadqtlocation-mapboxgl-2eec5a19803a01e21d5793706ae69ac0d886cee5.tar.gz
[core] move HeadlessBackend extension initialization code into Impl
Diffstat (limited to 'platform/qt')
-rw-r--r--platform/qt/src/headless_backend_qt.cpp30
-rw-r--r--platform/qt/src/qmapboxgl.cpp2
-rw-r--r--platform/qt/src/qmapboxgl_p.hpp2
3 files changed, 17 insertions, 17 deletions
diff --git a/platform/qt/src/headless_backend_qt.cpp b/platform/qt/src/headless_backend_qt.cpp
index 7985ca9f2d..ad3fa42290 100644
--- a/platform/qt/src/headless_backend_qt.cpp
+++ b/platform/qt/src/headless_backend_qt.cpp
@@ -12,9 +12,19 @@
namespace mbgl {
-class QtImpl : public HeadlessBackend::Impl {
+class QtBackendImpl : public HeadlessBackend::Impl {
public:
- ~QtImpl() final = default;
+ ~QtBackendImpl() final = default;
+
+ gl::ProcAddress getExtensionFunctionPointer(const char* name) final {
+#if QT_VERSION >= 0x050000
+ QOpenGLContext* thisContext = QOpenGLContext::currentContext();
+ return thisContext->getProcAddress(name);
+#else
+ const QGLContext* thisContext = QGLContext::currentContext();
+ return reinterpret_cast<gl::ProcAddress>(thisContext->getProcAddress(name));
+#endif
+ }
void activateContext() final {
widget.makeCurrent();
@@ -28,19 +38,9 @@ private:
QGLWidget widget;
};
-gl::ProcAddress HeadlessBackend::initializeExtension(const char* name) {
-#if QT_VERSION >= 0x050000
- QOpenGLContext* thisContext = QOpenGLContext::currentContext();
- return thisContext->getProcAddress(name);
-#else
- const QGLContext* thisContext = QGLContext::currentContext();
- return reinterpret_cast<gl::ProcAddress>(thisContext->getProcAddress(name));
-#endif
-}
-
-void HeadlessBackend::createContext() {
- assert(!hasContext());
- impl = std::make_unique<QtImpl>();
+void HeadlessBackend::createImpl() {
+ assert(!impl);
+ impl = std::make_unique<QtBackendImpl>();
}
} // namespace mbgl
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index cc1d88e22f..2675d87862 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1695,7 +1695,7 @@ void QMapboxGLPrivate::onSourceChanged(mbgl::style::Source&)
Initializes an OpenGL extension function such as Vertex Array Objects (VAOs),
required by Mapbox GL Native engine.
*/
-mbgl::gl::ProcAddress QMapboxGLPrivate::initializeExtension(const char* name) {
+mbgl::gl::ProcAddress QMapboxGLPrivate::getExtensionFunctionPointer(const char* name) {
#if QT_VERSION >= 0x050000
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp
index 5e12b44a20..f947c09f48 100644
--- a/platform/qt/src/qmapboxgl_p.hpp
+++ b/platform/qt/src/qmapboxgl_p.hpp
@@ -61,7 +61,7 @@ public:
bool dirty { false };
private:
- mbgl::gl::ProcAddress initializeExtension(const char*) override;
+ mbgl::gl::ProcAddress getExtensionFunctionPointer(const char*) override;
public slots:
void connectionEstablished();