summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-09-28 08:31:46 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-10-06 13:36:22 (GMT)
commit6d17e09c274803d324e8a8db579aaafaefaab33f (patch)
tree97079b1d08240847b38877816d43bd3bb2c9e026
parenta815840a7f2272b128de4a52497626c49373c8c9 (diff)
downloadQt-6d17e09c274803d324e8a8db579aaafaefaab33f.zip
Qt-6d17e09c274803d324e8a8db579aaafaefaab33f.tar.gz
Qt-6d17e09c274803d324e8a8db579aaafaefaab33f.tar.bz2
Moved GL 2 clip clearing code into a common function.
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp28
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h1
2 files changed, 15 insertions, 14 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index b7f9e2c..13f0079 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1699,25 +1699,30 @@ void QGL2PaintEngineEx::clipEnabledChanged()
}
}
+void QGL2PaintEngineExPrivate::clearClip(uint value)
+{
+ glDepthMask(true);
+ glClearDepth(rawDepth(value));
+ glClear(GL_DEPTH_BUFFER_BIT);
+ glDepthMask(false);
+
+ q->state()->needsClipBufferClear = false;
+}
+
void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value)
{
transferMode(BrushDrawingMode);
if (matrixDirty)
updateMatrix();
- if (q->state()->needsClipBufferClear) {
- glDepthMask(true);
- glClearDepth(rawDepth(1));
- glClear(GL_DEPTH_BUFFER_BIT);
- q->state()->needsClipBufferClear = false;
- }
-
- glDepthMask(false);
+ if (q->state()->needsClipBufferClear)
+ clearClip(1);
if (path.isEmpty())
return;
glDisable(GL_BLEND);
+ glDepthMask(false);
vertexCoordinateArray.clear();
vertexCoordinateArray.addPath(path, inverseScale);
@@ -1890,12 +1895,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
return;
}
#endif
- q->state()->needsClipBufferClear = false;
-
- glDepthMask(true);
-
- glClearDepth(0);
- glClear(GL_DEPTH_BUFFER_BIT);
+ clearClip(0);
QPainterPath path;
path.addRegion(systemClip);
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index fc61905..dd5f4fc 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -240,6 +240,7 @@ public:
QGLEngineShaderManager* shaderManager;
+ void clearClip(uint value);
void writeClip(const QVectorPath &path, uint value);
void updateClipScissorTest();
void setScissor(const QRect &rect);