summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2010-08-27 07:28:40 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-08-31 08:15:42 (GMT)
commit34d0cd1e65644970d890e52bd3c880fc941d99f9 (patch)
tree1944351b30cffcd623c88bc339c36355198b183e /src/opengl
parent63aa8c467941cf6cb19fc6fcad5c0efde0b53216 (diff)
downloadQt-34d0cd1e65644970d890e52bd3c880fc941d99f9.zip
Qt-34d0cd1e65644970d890e52bd3c880fc941d99f9.tar.gz
Qt-34d0cd1e65644970d890e52bd3c880fc941d99f9.tar.bz2
Clear the QGLWindowSurface in ::beginPaint when needed.
Merge-request: 2462 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qwindowsurface_gl.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index b86fb78..d602000 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -426,6 +426,20 @@ static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize,
void QGLWindowSurface::beginPaint(const QRegion &)
{
+ if (! context())
+ return;
+
+ int clearFlags = 0;
+
+ if (context()->d_func()->workaround_needsFullClearOnEveryFrame)
+ clearFlags = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
+ else if (context()->format().alpha())
+ clearFlags = GL_COLOR_BUFFER_BIT;
+
+ if (clearFlags) {
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(clearFlags);
+ }
}
void QGLWindowSurface::endPaint(const QRegion &rgn)