From 38d37b13a3aae54ef0480150247d96ac9da0247a Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Wed, 10 Sep 2014 13:34:51 -0500 Subject: Fix clip state tracking in Context2D A recent change (f45fe58ad2aa741c90b756643da75f1a6bc2fdf6) introduced the concept of clipping being disabled for a context, so that it can start with no clip path set. However, this state is not properly tracked, so an attempt to restore a context state which has no clip path does not work properly. This change adds this information to the Clip command, so that it can be properly restored. This patch also re-enables a test case which was supposed to check this behavior, but had been disabled. Task-number: QTBUG-40312 Change-Id: I3fd5626ecfcc1298a81931828cbb590290098a92 Reviewed-by: Ulf Hermann Reviewed-by: Gunnar Sletta --- src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp') diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp index 9e0a924462..a52f1c8cd2 100644 --- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp +++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp @@ -207,6 +207,7 @@ void QQuickContext2DCommandBuffer::setPainterState(QPainter* p, const QQuickCont if (state.globalCompositeOperation != p->compositionMode()) p->setCompositionMode(state.globalCompositeOperation); + p->setClipping(state.clip); if (state.clip) p->setClipPath(state.clipPath); } @@ -383,9 +384,11 @@ void QQuickContext2DCommandBuffer::replay(QPainter* p, QQuickContext2D::State& s } case QQuickContext2D::Clip: { + state.clip = takeBool(); state.clipPath = takePath(); - p->setClipping(true); - p->setClipPath(state.clipPath); + p->setClipping(state.clip); + if (state.clip) + p->setClipPath(state.clipPath); break; } case QQuickContext2D::GlobalAlpha: -- cgit v1.2.3