diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-24 16:18:52 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-24 16:18:52 (GMT) |
commit | f09b8e7b134c8dfe7e50d64662e943273d721d9a (patch) | |
tree | 19b13cbe46a5c676327c3b4098e527f465469523 /src/opengl/qwindowsurface_gl.cpp | |
parent | 295fbcba490712fe6e6f61926836920366134b55 (diff) | |
parent | 660f881f04a0880c83a0b43b4f4d0e89da082d92 (diff) | |
download | Qt-f09b8e7b134c8dfe7e50d64662e943273d721d9a.zip Qt-f09b8e7b134c8dfe7e50d64662e943273d721d9a.tar.gz Qt-f09b8e7b134c8dfe7e50d64662e943273d721d9a.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
src/opengl/qwindowsurface_gl.cpp
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 2ccbc50..eae1c9b 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -493,6 +493,14 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) } bool swapBehaviourPreserved = (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED) || (ctx->d_func()->eglContext->configAttrib(EGL_SURFACE_TYPE)&EGL_SWAP_BEHAVIOR_PRESERVED_BIT); + if (ctx->d_func()->eglContext->configAttrib(EGL_SURFACE_TYPE)&EGL_SWAP_BEHAVIOR_PRESERVED_BIT) { + EGLint swapBehavior; + if (eglQuerySurface(ctx->d_func()->eglContext->display(), ctx->d_func()->eglSurface + , EGL_SWAP_BEHAVIOR, &swapBehavior)) { + swapBehaviourPreserved = (swapBehavior == EGL_BUFFER_PRESERVED); + } + } + if (!swapBehaviourPreserved && !haveNOKSwapRegion) d_ptr->partialUpdateSupport = false; // Force full-screen updates else @@ -541,6 +549,7 @@ static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, void QGLWindowSurface::beginPaint(const QRegion &) { d_ptr->did_paint = true; + updateGeometry(); if (!context()) return; @@ -912,14 +921,22 @@ void QGLWindowSurface::updateGeometry() { ctx->d_func()->eglSurface = QEgl::createSurface(ctx->device(), ctx->d_func()->eglContext->config()); -#if !defined(QGL_NO_PRESERVED_SWAP) - eglGetError(); // Clear error state first. - eglSurfaceAttrib(QEgl::display(), ctx->d_func()->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) { - qWarning("QGLWindowSurface: could not restore preserved swap behaviour"); + eglGetError(); // Clear error state. + if (hasPartialUpdateSupport()) { + eglSurfaceAttrib(ctx->d_func()->eglContext->display(), + ctx->d_func()->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + + if (eglGetError() != EGL_SUCCESS) + qWarning("QGLWindowSurface: could not enable preserved swap behaviour"); + } else { + eglSurfaceAttrib(ctx->d_func()->eglContext->display(), + ctx->d_func()->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); + + if (eglGetError() != EGL_SUCCESS) + qWarning("QGLWindowSurface: could not enable destroyed swap behaviour"); } -#endif } #endif |