diff options
author | Bjoern Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-04-29 17:51:02 (GMT) |
---|---|---|
committer | Bjoern Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-04-29 17:51:02 (GMT) |
commit | d355e069ca1952504ef8cc6fb44350b53314d5d5 (patch) | |
tree | f2372d54b1bf988312ff4ab0b91b7d3e74629367 /src | |
parent | d20bf7c8b368cb56df1a965793edbd23ff0c3213 (diff) | |
parent | 073b7ce298b0e079f310ec22dee44a9fc0af9ee6 (diff) | |
download | Qt-d355e069ca1952504ef8cc6fb44350b53314d5d5.zip Qt-d355e069ca1952504ef8cc6fb44350b53314d5d5.tar.gz Qt-d355e069ca1952504ef8cc6fb44350b53314d5d5.tar.bz2 |
Merge commit 'origin/4.5'
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qlayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 31 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 4 |
4 files changed, 32 insertions, 14 deletions
diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index aa46249..1d5a70d 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/kernel/qlayout.cpp @@ -1239,7 +1239,7 @@ bool QLayout::activate() Must be implemented in subclasses to remove the layout item at \a index from the layout, and return the item. If there is no such item, the function must do nothing and return 0. Items are numbered - consecutively from 0. If an item is deleted, other items will be + consecutively from 0. If an item is removed, other items will be renumbered. The following code fragment shows a safe way to remove all items diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dfc8365..dd95053 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4829,8 +4829,13 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, const QRegion oldSystemClip = enginePriv->systemClip; const QRegion oldSystemViewport = enginePriv->systemViewport; - // This ensures that transformed system clips are inside the current system clip. - enginePriv->setSystemViewport(oldSystemClip); + // This ensures that all painting triggered by render() is clipped to the current engine clip. + if (painter->hasClipping()) { + const QRegion painterClip = painter->deviceTransform().map(painter->clipRegion()); + enginePriv->setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip); + } else { + enginePriv->setSystemViewport(oldSystemClip); + } render(target, targetOffset, toBePainted, renderFlags); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d9c7937..b158392 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2398,7 +2398,6 @@ QRegion QPainter::clipRegion() const // ### Falcon: Use QPainterPath for (int i=0; i<d->state->clipInfo.size(); ++i) { const QPainterClipInfo &info = d->state->clipInfo.at(i); - QRegion other; switch (info.clipType) { case QPainterClipInfo::RegionClip: { @@ -2451,15 +2450,20 @@ QRegion QPainter::clipRegion() const lastWasNothing = false; continue; } - if (info.operation == Qt::IntersectClip) - region &= QRegion(info.rect) * matrix; - else if (info.operation == Qt::UniteClip) + if (info.operation == Qt::IntersectClip) { + // Use rect intersection if possible. + if (matrix.type() <= QTransform::TxScale) + region &= matrix.mapRect(info.rect); + else + region &= matrix.map(QRegion(info.rect)); + } else if (info.operation == Qt::UniteClip) { region |= QRegion(info.rect) * matrix; - else if (info.operation == Qt::NoClip) { + } else if (info.operation == Qt::NoClip) { lastWasNothing = true; region = QRegion(); - } else + } else { region = QRegion(info.rect) * matrix; + } break; } @@ -2470,15 +2474,20 @@ QRegion QPainter::clipRegion() const lastWasNothing = false; continue; } - if (info.operation == Qt::IntersectClip) - region &= QRegion(info.rectf.toRect()) * matrix; - else if (info.operation == Qt::UniteClip) + if (info.operation == Qt::IntersectClip) { + // Use rect intersection if possible. + if (matrix.type() <= QTransform::TxScale) + region &= matrix.mapRect(info.rectf.toRect()); + else + region &= matrix.map(QRegion(info.rectf.toRect())); + } else if (info.operation == Qt::UniteClip) { region |= QRegion(info.rectf.toRect()) * matrix; - else if (info.operation == Qt::NoClip) { + } else if (info.operation == Qt::NoClip) { lastWasNothing = true; region = QRegion(); - } else + } else { region = QRegion(info.rectf.toRect()) * matrix; + } break; } } diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index d06107f..4a33b92 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1387,12 +1387,16 @@ QRegion QTransform::map(const QRegion &r) const TransformationType t = inline_type(); if (t == TxNone) return r; + if (t == TxTranslate) { QRegion copy(r); copy.translate(qRound(affine._dx), qRound(affine._dy)); return copy; } + if (t == TxScale && r.numRects() == 1) + return QRegion(mapRect(r.boundingRect())); + QPainterPath p = map(qt_regionToPath(r)); return p.toFillPolygon(QTransform()).toPolygon(); } |