aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp6
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp7
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h3
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_state.qml2
4 files changed, 11 insertions, 7 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 28c84facb5..d9ac3abdc3 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -3548,7 +3548,7 @@ void QQuickContext2D::clip()
state.clip = true;
state.clipPath = clipPath;
}
- buffer()->clip(state.clipPath);
+ buffer()->clip(state.clip, state.clipPath);
}
void QQuickContext2D::stroke()
@@ -4283,8 +4283,8 @@ void QQuickContext2D::popState()
if (newState.miterLimit != state.miterLimit)
buffer()->setMiterLimit(newState.miterLimit);
- if (newState.clip && (!state.clip || newState.clipPath != state.clipPath))
- buffer()->clip(newState.clipPath);
+ if (newState.clip != state.clip || newState.clipPath != state.clipPath)
+ buffer()->clip(newState.clip, newState.clipPath);
if (newState.shadowBlur != state.shadowBlur)
buffer()->setShadowBlur(newState.shadowBlur);
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:
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
index 9b2fde33d8..4e6232ac7f 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
@@ -145,9 +145,10 @@ public:
pathes << path;
}
- inline void clip(const QPainterPath& path)
+ inline void clip(bool enabled, const QPainterPath& path)
{
commands << QQuickContext2D::Clip;
+ bools << enabled;
pathes << path;
}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_state.qml b/tests/auto/quick/qquickcanvasitem/data/tst_state.qml
index 1ceb17b31b..18464def7c 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_state.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_state.qml
@@ -30,7 +30,7 @@ CanvasTestCase {
ctx.restore();
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
- //comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
canvas.destroy()
}
function test_fillStyle(row) {