--- a/src/opengl/qwindowsurface_gl.cpp Tue Jul 06 15:10:48 2010 +0300
+++ b/src/opengl/qwindowsurface_gl.cpp Wed Aug 18 10:37:55 2010 +0300
@@ -354,8 +354,22 @@
ctx->create(qt_gl_share_widget()->context());
#ifndef QT_NO_EGL
- if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED)
+ static bool checkedForNOKSwapRegion = false;
+ static bool haveNOKSwapRegion = false;
+
+ if (!checkedForNOKSwapRegion) {
+ haveNOKSwapRegion = QEgl::hasExtension("EGL_NOK_swap_region2");
+ checkedForNOKSwapRegion = true;
+
+ if (haveNOKSwapRegion)
+ qDebug() << "Found EGL_NOK_swap_region2 extension. Using partial updates.";
+ }
+
+ if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED &&
+ ! haveNOKSwapRegion)
setPartialUpdateSupport(false); // Force full-screen updates
+ else
+ setPartialUpdateSupport(true);
#endif
widgetPrivate->extraData()->glContext = ctx;
@@ -480,8 +494,14 @@
}
}
#endif
+ if (d_ptr->paintedRegion.boundingRect() != geometry()) {
+ // Emits warning if not supported. Should never happen unless
+ // setPartialUpdateSupport(true) has been called.
+ context()->d_func()->swapRegion(&d_ptr->paintedRegion);
+ } else
+ context()->swapBuffers();
+
d_ptr->paintedRegion = QRegion();
- context()->swapBuffers();
} else {
glFlush();
}