diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-06-21 13:39:26 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-06-21 14:02:22 +0200 |
commit | 176f30b13739b352cbe453cba7796d9a9c808bcd (patch) | |
tree | 8fa60b6ae4ef06455652863a0406bc5e86a22303 /src/gui/kernel/qguiglcontext_qpa.cpp | |
parent | 272daebaa07b21e372ad4274fafb51ce0be92396 (diff) |
OpenGL API refactor.
Rename QGuiGLFormat to QSurfaceFormat, and make QWindow sub-class of
QSurface and QPlatformWindow sub-class of QPlatformSurface, instead of
having QPlatformGLSurface accessor in QWindow.
Diffstat (limited to 'src/gui/kernel/qguiglcontext_qpa.cpp')
-rw-r--r-- | src/gui/kernel/qguiglcontext_qpa.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/kernel/qguiglcontext_qpa.cpp b/src/gui/kernel/qguiglcontext_qpa.cpp index 4b30b41ab8..fd827966c4 100644 --- a/src/gui/kernel/qguiglcontext_qpa.cpp +++ b/src/gui/kernel/qguiglcontext_qpa.cpp @@ -120,7 +120,7 @@ QPlatformGLContext *QGuiGLContext::handle() const /*! Creates a new GL context with the given format and shared context. */ -QGuiGLContext::QGuiGLContext(const QGuiGLFormat &format, QGuiGLContext *shareContext) +QGuiGLContext::QGuiGLContext(const QSurfaceFormat &format, QGuiGLContext *shareContext) : d_ptr(new QGuiGLContextPrivate()) { Q_D(QGuiGLContext); @@ -149,7 +149,7 @@ bool QGuiGLContext::isValid() const /*! If surface is 0 this is equivalent to calling doneCurrent(). */ -bool QGuiGLContext::makeCurrent(QPlatformGLSurface *surface) +bool QGuiGLContext::makeCurrent(QSurface *surface) { Q_D(QGuiGLContext); if (!d->platformGLContext) @@ -160,7 +160,10 @@ bool QGuiGLContext::makeCurrent(QPlatformGLSurface *surface) return true; } - if (d->platformGLContext->makeCurrent(*surface)) { + if (!surface->surfaceHandle()) + return false; + + if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) { QGuiGLContextPrivate::setCurrentContext(this); return true; } @@ -181,7 +184,7 @@ void QGuiGLContext::doneCurrent() QGuiGLContextPrivate::setCurrentContext(0); } -void QGuiGLContext::swapBuffers(QPlatformGLSurface *surface) +void QGuiGLContext::swapBuffers(QSurface *surface) { Q_D(QGuiGLContext); if (!d->platformGLContext) @@ -192,7 +195,7 @@ void QGuiGLContext::swapBuffers(QPlatformGLSurface *surface) return; } - d->platformGLContext->swapBuffers(*surface); + d->platformGLContext->swapBuffers(surface->surfaceHandle()); } void (*QGuiGLContext::getProcAddress(const QByteArray &procName)) () @@ -203,11 +206,11 @@ void (*QGuiGLContext::getProcAddress(const QByteArray &procName)) () return d->platformGLContext->getProcAddress(procName); } -QGuiGLFormat QGuiGLContext::format() const +QSurfaceFormat QGuiGLContext::format() const { Q_D(const QGuiGLContext); if (!d->platformGLContext) - return QGuiGLFormat(); + return QSurfaceFormat(); return d->platformGLContext->format(); } |