summaryrefslogtreecommitdiffstats
path: root/src/opengl/qpaintengine_opengl.cpp
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2009-10-20 08:37:09 (GMT)
committerTrond Kjernaasen <trond@trolltech.com>2009-10-20 08:42:27 (GMT)
commit23b058cdf3d98439ec784a3d430d54e5aed75c7b (patch)
treec90b54a4da63c5f9b95c736daf4ad76fc7f71726 /src/opengl/qpaintengine_opengl.cpp
parent43b3307bebb9600954e48b0a3b341d5d9b2b26de (diff)
downloadQt-23b058cdf3d98439ec784a3d430d54e5aed75c7b.zip
Qt-23b058cdf3d98439ec784a3d430d54e5aed75c7b.tar.gz
Qt-23b058cdf3d98439ec784a3d430d54e5aed75c7b.tar.bz2
Fixed a stencil clearing bug in the GL 1 engine.
If the system clip changed the stencil buffer wasn't necessarily updated correctly. Use a region to keep track of the dirty areas in the stencil buffer, like we do in the GL 2 engine. Reviewed-by: Samuel
Diffstat (limited to 'src/opengl/qpaintengine_opengl.cpp')
-rw-r--r--src/opengl/qpaintengine_opengl.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 80628a2..aa6b6c9 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -746,7 +746,6 @@ public:
uint has_brush : 1;
uint has_fast_pen : 1;
uint use_stencil_method : 1;
- uint dirty_stencil : 1;
uint dirty_drawable_texture : 1;
uint has_stencil_face_ext : 1;
uint use_fragment_programs : 1;
@@ -757,6 +756,8 @@ public:
uint use_system_clip : 1;
uint use_emulation : 1;
+ QRegion dirty_stencil;
+
void updateUseEmulation();
QTransform matrix;
@@ -1259,7 +1260,9 @@ bool QOpenGLPaintEngine::begin(QPaintDevice *pdev)
d->matrix = QTransform();
d->has_antialiasing = false;
d->high_quality_antialiasing = false;
- d->dirty_stencil = true;
+
+ QSize sz(d->device->size());
+ d->dirty_stencil = QRect(0, 0, sz.width(), sz.height());
d->use_emulation = false;
@@ -1347,7 +1350,6 @@ bool QOpenGLPaintEngine::begin(QPaintDevice *pdev)
d->offscreen.begin();
- QSize sz(d->device->size());
glViewport(0, 0, sz.width(), sz.height()); // XXX (Embedded): We need a solution for GLWidgets that draw in a part or a bigger surface...
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -1949,34 +1951,34 @@ void QOpenGLPaintEnginePrivate::fillVertexArray(Qt::FillRule fillRule)
{
Q_Q(QOpenGLPaintEngine);
- if (dirty_stencil) {
- disableClipping();
+ QRect rect = dirty_stencil.boundingRect();
- if (use_system_clip) {
- glEnable(GL_SCISSOR_TEST);
+ if (use_system_clip)
+ rect = q->systemClip().intersected(dirty_stencil).boundingRect();
- QRect rect = q->systemClip().boundingRect();
+ glStencilMask(~0);
- const int left = rect.left();
- const int width = rect.width();
- const int bottom = device->size().height() - (rect.bottom() + 1);
- const int height = rect.height();
+ if (!rect.isEmpty()) {
+ disableClipping();
- glScissor(left, bottom, width, height);
- }
+ glEnable(GL_SCISSOR_TEST);
+
+ const int left = rect.left();
+ const int width = rect.width();
+ const int bottom = device->size().height() - (rect.bottom() + 1);
+ const int height = rect.height();
+
+ glScissor(left, bottom, width, height);
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
- dirty_stencil = false;
+ dirty_stencil -= rect;
- if (use_system_clip)
- glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_SCISSOR_TEST);
enableClipping();
}
- glStencilMask(~0);
-
// Enable stencil.
glEnable(GL_STENCIL_TEST);