diff options
Diffstat (limited to 'platform/qt/src/headless_backend_qt.cpp')
-rw-r--r-- | platform/qt/src/headless_backend_qt.cpp | 30 |
1 files changed, 15 insertions, 15 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 |