diff options
author | Jason Barron <jbarron@trolltech.com> | 2010-04-09 11:21:32 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2010-04-09 11:52:41 (GMT) |
commit | 385f2c8a34a52443e78dfa272a1a483b9d6d29fc (patch) | |
tree | 2250b334717ed9b9ca3b22ff9cc9f9409e21757a /src/openvg | |
parent | 274fbf5c1847ffbee9967064068ee8e23b141198 (diff) | |
download | Qt-385f2c8a34a52443e78dfa272a1a483b9d6d29fc.zip Qt-385f2c8a34a52443e78dfa272a1a483b9d6d29fc.tar.gz Qt-385f2c8a34a52443e78dfa272a1a483b9d6d29fc.tar.bz2 |
Enable preserved swap behavior when surface is created due to resize.
When the QVG_RECREATE_ON_SIZE_CHANGE macro is defined the EGL surface
is recreated. However, after creating the surface, we were neglecting
to set the surface attribute that enabled the preserved swapping
behavior of EGL. This lead to flicker because every second frame was
swapping with an empty buffer and only the dirty areas were being
painted leaving the rest empty.
Reviewed-by: Lars Knoll
Reviewed-by: Aleksandar Sasha Babic
Task-number: QT-3198
Task-number: QT-3184
Task-number: QT-3201
Diffstat (limited to 'src/openvg')
-rw-r--r-- | src/openvg/qwindowsurface_vgegl.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index f46d6c2..46a905f 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -659,6 +659,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) #endif windowSurface = context->createSurface(widget, &surfaceProps); isPaintingActive = false; + needToSwap = true; } #else if (context && size != newSize) { @@ -710,20 +711,21 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) needToSwap = false; } #endif -#if !defined(QVG_NO_PRESERVED_SWAP) - // Try to force the surface back buffer to preserve its contents. - if (needToSwap) { - eglGetError(); // Clear error state first. - eglSurfaceAttrib(QEglContext::display(), surface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) { - qWarning("QVG: could not enable preserved swap"); - } - } -#endif windowSurface = surface; isPaintingActive = false; } + +#if !defined(QVG_NO_PRESERVED_SWAP) + // Try to force the surface back buffer to preserve its contents. + if (needToSwap) { + eglGetError(); // Clear error state first. + eglSurfaceAttrib(QEglContext::display(), windowSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + if (eglGetError() != EGL_SUCCESS) { + qWarning("QVG: could not enable preserved swap"); + } + } +#endif return context; } |