diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-12-14 21:21:52 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-12-14 21:21:52 (GMT) |
commit | 19b77ecfcdae8a68cfec5d89cf510b9cc837bed2 (patch) | |
tree | 64e56d7b9f2809e3b8a6d8e492d2184217d5e5fa | |
parent | 1d0ddf8037c068ff584dda60cffeb6b2b506d4b2 (diff) | |
parent | 4d93a606ea0438be8062fda82baf639a9ced78ba (diff) | |
download | Qt-19b77ecfcdae8a68cfec5d89cf510b9cc837bed2.zip Qt-19b77ecfcdae8a68cfec5d89cf510b9cc837bed2.tar.gz Qt-19b77ecfcdae8a68cfec5d89cf510b9cc837bed2.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Trivial: Fix coding style
Prevent ::flush from being called on QGLWindowSurface if no painting happened.
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index f64b93c..7dc7dc7 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -267,6 +267,7 @@ struct QGLWindowSurfacePrivate int tried_pb : 1; int destructive_swap_buffers : 1; int geometry_updated : 1; + int did_paint : 1; QGLContext *ctx; @@ -330,6 +331,7 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window) d_ptr->glDevice.d = d_ptr; d_ptr->q_ptr = this; d_ptr->geometry_updated = false; + d_ptr->did_paint = false; } QGLWindowSurface::~QGLWindowSurface() @@ -461,6 +463,8 @@ void QGLWindowSurface::beginPaint(const QRegion &) glClearColor(0.0, 0.0, 0.0, 0.0); glClear(clearFlags); } + + d_ptr->did_paint = true; } void QGLWindowSurface::endPaint(const QRegion &rgn) @@ -513,6 +517,13 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & if (d_ptr->geometry_updated) return; + // 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) + return; + QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); @@ -736,6 +747,8 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & ctx->swapBuffers(); else glFlush(); + + d_ptr->did_paint = false; } |