diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-01-10 14:11:52 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-01-10 14:11:52 (GMT) |
commit | 44afade51254de33a0f31baf39034af0eb73842f (patch) | |
tree | cd9c75a8d37be58a5022a545aa939eff9e196730 /src/opengl/qwindowsurface_gl.cpp | |
parent | 3263f8036128cc4403cf6383324f5390eecee13b (diff) | |
parent | 2bddf15b87a9e27bfdcbc3aec5d79da49f070c15 (diff) | |
download | Qt-44afade51254de33a0f31baf39034af0eb73842f.zip Qt-44afade51254de33a0f31baf39034af0eb73842f.tar.gz Qt-44afade51254de33a0f31baf39034af0eb73842f.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 6185ff8..81575e3 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -302,6 +302,7 @@ struct QGLWindowSurfacePrivate }; QGLFormat QGLWindowSurface::surfaceFormat; +QGLWindowSurface::SwapMode QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap; void QGLWindowSurfaceGLPaintDevice::endPaint() { @@ -549,9 +550,10 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & // did_paint is set to true in ::beginPaint. ::beginPaint means that we // at least cleared the background (= painted something). In EGL API it's a - // mistakte to call swapBuffers if nothing was painted. This check protects - // the flush func from being executed if it's for nothing. - if (!d_ptr->did_paint) + // mistake to call swapBuffers if nothing was painted unless + // EGL_BUFFER_PRESERVED is set. This check protects the flush func from + // being executed if it's for nothing. + if (!hasPartialUpdateSupport() && !d_ptr->did_paint) return; QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); @@ -576,6 +578,9 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & const GLenum target = GL_TEXTURE_2D; Q_UNUSED(target); + if (QGLWindowSurface::swapBehavior == QGLWindowSurface::KillSwap) + return; + if (context()) { context()->makeCurrent(); @@ -623,7 +628,14 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif - bool doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2; + bool doingPartialUpdate = false; + if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AutomaticSwap) + doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2; + else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysFullSwap) + doingPartialUpdate = false; + else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysPartialSwap) + doingPartialUpdate = hasPartialUpdateSupport(); + QGLContext *ctx = reinterpret_cast<QGLContext *>(parent->d_func()->extraData()->glContext); if (widget != window()) { if (initializeOffscreenTexture(window()->size())) |