diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-18 10:10:12 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-18 11:19:33 (GMT) |
commit | c23d4d6644bff2195fbb6aa84d3425dc2d31491a (patch) | |
tree | 970980e9abfeef24567b1423b81bdd46ad351aaa /src/opengl | |
parent | b11eb293ca873691e4a84afdf4e89ecf16ed03b1 (diff) | |
download | Qt-c23d4d6644bff2195fbb6aa84d3425dc2d31491a.zip Qt-c23d4d6644bff2195fbb6aa84d3425dc2d31491a.tar.gz Qt-c23d4d6644bff2195fbb6aa84d3425dc2d31491a.tar.bz2 |
Prevented unnecessary depth clip updates in OpenGL paint engine.
Keep track of whether the depth clip has actually changed between
states, so that when QPainter::restore() is called we don't call the
potentially expensive updateDepthClip() function when not needed.
Task-number: 254658
Reviewed-by: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 10 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl_p.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 044090b..b594f5b 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -2222,6 +2222,8 @@ void QOpenGLPaintEnginePrivate::updateDepthClip() { Q_Q(QOpenGLPaintEngine); + ++q->state()->depthClipId; + glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); @@ -5504,6 +5506,9 @@ void QOpenGLPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) void QOpenGLPaintEngine::setState(QPainterState *s) { Q_D(QOpenGLPaintEngine); + QOpenGLPaintEngineState *new_state = static_cast<QOpenGLPaintEngineState *>(s); + QOpenGLPaintEngineState *old_state = state(); + QPaintEngineEx::setState(s); // are we in a save() ? @@ -5513,7 +5518,8 @@ void QOpenGLPaintEngine::setState(QPainterState *s) } if (isActive()) { - d->updateDepthClip(); + if (old_state->depthClipId != new_state->depthClipId) + d->updateDepthClip(); penChanged(); brushChanged(); opacityChanged(); @@ -5547,11 +5553,13 @@ QOpenGLPaintEngineState::QOpenGLPaintEngineState(QOpenGLPaintEngineState &other) clipRegion = other.clipRegion; hasClipping = other.hasClipping; fastClip = other.fastClip; + depthClipId = other.depthClipId; } QOpenGLPaintEngineState::QOpenGLPaintEngineState() { hasClipping = false; + depthClipId = 0; } QOpenGLPaintEngineState::~QOpenGLPaintEngineState() diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index 891cbd6..439782b 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -69,6 +69,7 @@ public: QRegion clipRegion; bool hasClipping; QRect fastClip; + uint depthClipId; }; class QOpenGLPaintEngine : public QPaintEngineEx |