summaryrefslogtreecommitdiffstats
path: root/src/openvg/qwindowsurface_vgegl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvg/qwindowsurface_vgegl.cpp')
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 9b55fd2..13ae807 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(QEgl::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(QEgl::display(), windowSurface,
+ EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
+ if (eglGetError() != EGL_SUCCESS) {
+ qWarning("QVG: could not enable preserved swap");
+ }
+ }
+#endif
return context;
}