Don't replace IntersectClip with ReplaceClip on a QPicture
QPainter should not try to be smart and optimize IntersectClip with ReplaceClip when working on a QPicture paint device. Doing so will change the end result as the actually state when replayed might be different from the one it was recorded in. [ChangeLog][QtGui][QPainter] QPainter will no longer try to replace IntersectClip with ReplaceClip if the paint engine is a QPicture. Task-number: QTBUG-35830 Change-Id: I0693d932f037336b960c34bb8fe840e8afe04fe6 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
parent
3430e7ce77
commit
91ee17dce3
@ -2720,13 +2720,14 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op)
|
||||
Q_D(QPainter);
|
||||
|
||||
if (d->extended) {
|
||||
if ((!d->state->clipEnabled && op != Qt::NoClip))
|
||||
op = Qt::ReplaceClip;
|
||||
|
||||
if (!d->engine) {
|
||||
qWarning("QPainter::setClipRect: Painter not active");
|
||||
return;
|
||||
}
|
||||
bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture);
|
||||
if (simplifyClipOp && (!d->state->clipEnabled && op != Qt::NoClip))
|
||||
op = Qt::ReplaceClip;
|
||||
|
||||
qreal right = rect.x() + rect.width();
|
||||
qreal bottom = rect.y() + rect.height();
|
||||
qreal pts[] = { rect.x(), rect.y(),
|
||||
@ -2777,8 +2778,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op)
|
||||
qWarning("QPainter::setClipRect: Painter not active");
|
||||
return;
|
||||
}
|
||||
bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture);
|
||||
|
||||
if ((!d->state->clipEnabled && op != Qt::NoClip))
|
||||
if (simplifyClipOp && (!d->state->clipEnabled && op != Qt::NoClip))
|
||||
op = Qt::ReplaceClip;
|
||||
|
||||
if (d->extended) {
|
||||
@ -2791,7 +2793,7 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op)
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip)
|
||||
if (simplifyClipOp && d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip)
|
||||
op = Qt::ReplaceClip;
|
||||
|
||||
d->state->clipRegion = rect;
|
||||
@ -2835,8 +2837,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
|
||||
qWarning("QPainter::setClipRegion: Painter not active");
|
||||
return;
|
||||
}
|
||||
bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture);
|
||||
|
||||
if ((!d->state->clipEnabled && op != Qt::NoClip))
|
||||
if (simplifyClipOp && (!d->state->clipEnabled && op != Qt::NoClip))
|
||||
op = Qt::ReplaceClip;
|
||||
|
||||
if (d->extended) {
|
||||
@ -2849,7 +2852,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip)
|
||||
if (simplifyClipOp && d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip)
|
||||
op = Qt::ReplaceClip;
|
||||
|
||||
d->state->clipRegion = r;
|
||||
|
Loading…
Reference in New Issue
Block a user