QPainterPath clipPath = m_path;
clipPath.closeSubpath();
- if (!state.clipPath.isEmpty())
+ if (state.clip) {
state.clipPath = clipPath.intersected(state.clipPath);
- else
+ } else {
+ state.clip = true;
state.clipPath = clipPath;
+ }
buffer()->clip(state.clipPath);
}
if (newState.miterLimit != state.miterLimit)
buffer()->setMiterLimit(newState.miterLimit);
- if (newState.clipPath != state.clipPath) {
+ if (newState.clip && (!state.clip || newState.clipPath != state.clipPath))
buffer()->clip(newState.clipPath);
- }
if (newState.shadowBlur != state.shadowBlur)
buffer()->setShadowBlur(newState.shadowBlur);
m_path = QPainterPath();
- QPainterPath defaultClipPath;
-
- QRect r(0, 0, m_canvas->canvasSize().width(), m_canvas->canvasSize().height());
- r = r.united(m_canvas->canvasWindow().toRect());
- defaultClipPath.addRect(r);
- newState.clipPath = defaultClipPath;
newState.clipPath.setFillRule(Qt::WindingFill);
m_stateStack.clear();
, strokePatternRepeatX(false)
, strokePatternRepeatY(false)
, invertibleCTM(true)
+ , clip(false)
, fillRule(Qt::WindingFill)
, globalAlpha(1.0)
, lineWidth(1)
bool strokePatternRepeatX:1;
bool strokePatternRepeatY:1;
bool invertibleCTM:1;
+ bool clip:1;
Qt::FillRule fillRule;
qreal globalAlpha;
qreal lineWidth;
if (state.globalCompositeOperation != p->compositionMode())
p->setCompositionMode(state.globalCompositeOperation);
- p->setClipPath(state.clipPath);
+ if (state.clip)
+ p->setClipPath(state.clipPath);
}
static void qt_drawImage(QPainter *p, QQuickContext2D::State& state, QImage image, const QRectF& sr, const QRectF& dr, bool shadow = false)