diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-28 10:24:13 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-28 14:52:54 (GMT) |
commit | a33ef62469fd71bec7ed21e3a0ce7c2b12464a2d (patch) | |
tree | ce1e88d2bcd680968d209afbb41d79ff5eca6740 /src/gui/painting | |
parent | 8ac7817f7a294428f4eda3c10f519e14fe9d71a0 (diff) | |
download | Qt-a33ef62469fd71bec7ed21e3a0ce7c2b12464a2d.zip Qt-a33ef62469fd71bec7ed21e3a0ce7c2b12464a2d.tar.gz Qt-a33ef62469fd71bec7ed21e3a0ce7c2b12464a2d.tar.bz2 |
Fixed performance issue in QML clipping with OpenGL 2.0 paint engine.
Change 4c515ceb fixed Intersect and Unite-clipping after doing
setClipping(false), but also introduced a performance problem.
If there was no pre-existing clip we'd convert IntersectClips to
ReplaceClips, which is unnecessary since the paint engines already
handle this correctly.
IntersectClips can be handled much more efficiently in the OpenGL 2
paint engine for example. We only need to convert to ReplaceClip when
someone has used setClipEnabled(false) which is anyways expensive and
not recommended.
Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 12be93e..5fbe3ed 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2717,7 +2717,7 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op) Q_D(QPainter); if (d->extended) { - if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip)) op = Qt::ReplaceClip; if (!d->engine) { @@ -2775,7 +2775,7 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } - if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip)) op = Qt::ReplaceClip; if (d->extended) { @@ -2830,7 +2830,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } - if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip)) op = Qt::ReplaceClip; if (d->extended) { @@ -3235,7 +3235,7 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) return; } - if (!hasClipping() && (op == Qt::IntersectClip || op == Qt::UniteClip)) + if ((!d->state->clipEnabled && op != Qt::NoClip) || (d->state->clipOperation == Qt::NoClip && op == Qt::UniteClip)) op = Qt::ReplaceClip; if (d->extended) { |