summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2011-01-04 09:53:57 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-01-04 09:53:57 (GMT)
commitb5acfc61f3989ab8b72f784431fc5ab168ffb975 (patch)
treec92646d1f1399187cc4f7adf44a8e825481ee915
parent3ad35ffdbfcbd2db5e8aac95fa0cc9f80e372128 (diff)
downloadQt-b5acfc61f3989ab8b72f784431fc5ab168ffb975.zip
Qt-b5acfc61f3989ab8b72f784431fc5ab168ffb975.tar.gz
Qt-b5acfc61f3989ab8b72f784431fc5ab168ffb975.tar.bz2
Support for swap modes in QGLWindowSurface.
AlwaysFull and AlwaysPartial implemented in ES only for now. By default do automatic. Merge-request: 993 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
-rw-r--r--src/opengl/qwindowsurface_gl.cpp13
-rw-r--r--src/opengl/qwindowsurface_gl_p.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 7dc7dc7..b8716ce 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -284,6 +284,7 @@ struct QGLWindowSurfacePrivate
};
QGLFormat QGLWindowSurface::surfaceFormat;
+QGLWindowSurface::SwapMode QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap;
void QGLWindowSurfaceGLPaintDevice::endPaint()
{
@@ -541,6 +542,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();
@@ -588,7 +592,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()))
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index 6906f35..9b0bee3 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -102,6 +102,9 @@ public:
static QGLFormat surfaceFormat;
+ enum SwapMode { AutomaticSwap, AlwaysFullSwap, AlwaysPartialSwap, KillSwap };
+ static SwapMode swapBehavior;
+
private slots:
void deleted(QObject *object);