diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-12 21:52:30 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-12 21:52:30 (GMT) |
commit | d08d4e1ce4a5fcf5b92465ac2769f2f38b601e9f (patch) | |
tree | e1ccbceff5444ccbb95737fc12c92473d7f60279 /src/opengl | |
parent | 7a1d1dca32c98a9bc3fb518beed70caf8334c7c4 (diff) | |
download | Qt-d08d4e1ce4a5fcf5b92465ac2769f2f38b601e9f.zip Qt-d08d4e1ce4a5fcf5b92465ac2769f2f38b601e9f.tar.gz Qt-d08d4e1ce4a5fcf5b92465ac2769f2f38b601e9f.tar.bz2 |
Fix save() and restore() for the OpenGL2 paint engine.
Task-number: QTBUG-4822, QTBUG-4824
Reviewed-by: Sarah Smith
Reviewed-by: Samuel
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 25 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 3 |
2 files changed, 15 insertions, 13 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ab02c69..8130151 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1625,7 +1625,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) const QSize sz = d->device->size(); d->width = sz.width(); d->height = sz.height(); - d->last_created_state = 0; d->mode = BrushDrawingMode; d->brushTextureDirty = true; d->brushUniformsDirty = true; @@ -2023,27 +2022,32 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) QPaintEngineEx::setState(s); - if (s == d->last_created_state) { - d->last_created_state = 0; + if (s->isNew) { + // Newly created state object. The call to setState() + // will either be followed by a call to begin(), or we are + // setting the state as part of a save(). + s->isNew = false; return; } - if (old_state == s || s->renderHintsChanged) + // Setting the state as part of a restore(). + + if (old_state == s || old_state->renderHintsChanged) renderHintsChanged(); - if (old_state == s || s->matrixChanged) { + if (old_state == s || old_state->matrixChanged) { d->matrixDirty = true; d->simpleShaderMatrixUniformDirty = true; d->shaderMatrixUniformDirty = true; } - if (old_state == s || s->compositionModeChanged) + if (old_state == s || old_state->compositionModeChanged) d->compositionModeDirty = true; - if (old_state == s || s->opacityChanged) + if (old_state == s || old_state->opacityChanged) d->opacityUniformDirty = true; - if (old_state == s || s->clipChanged) { + if (old_state == s || old_state->clipChanged) { if (old_state && old_state != s && old_state->canRestoreClip) { d->updateClipScissorTest(); glDepthFunc(GL_LEQUAL); @@ -2055,8 +2059,6 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const { - Q_D(const QGL2PaintEngineEx); - if (orig) const_cast<QGL2PaintEngineEx *>(this)->ensureActive(); @@ -2072,7 +2074,6 @@ QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const s->renderHintsChanged = false; s->clipChanged = false; - d->last_created_state = s; return s; } @@ -2085,6 +2086,7 @@ void QGL2PaintEngineEx::setRenderTextActive(bool active) QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other) : QPainterState(other) { + isNew = true; needsClipBufferClear = other.needsClipBufferClear; clipTestEnabled = other.clipTestEnabled; currentClip = other.currentClip; @@ -2094,6 +2096,7 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &oth QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() { + isNew = true; needsClipBufferClear = true; clipTestEnabled = false; canRestoreClip = true; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 46be398..5704a04 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -82,6 +82,7 @@ public: QOpenGL2PaintEngineState(); ~QOpenGL2PaintEngineState(); + uint isNew : 1; uint needsClipBufferClear : 1; uint clipTestEnabled : 1; uint canRestoreClip : 1; @@ -212,8 +213,6 @@ public: EngineMode mode; QFontEngineGlyphCache::Type glyphCacheType; - mutable QOpenGL2PaintEngineState *last_created_state; - // Dirty flags bool matrixDirty; // Implies matrix uniforms are also dirty bool compositionModeDirty; |