summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorBjoern Erik Nilsen <bnilsen@trolltech.com>2009-04-24 15:34:28 (GMT)
committerBjoern Erik Nilsen <bnilsen@trolltech.com>2009-04-24 15:34:28 (GMT)
commited21b9dafea192ddd39f1d2a4abcb54962d6dfb8 (patch)
tree62bb3042bc91353c3e6293ad7eb48a3389b0fb69 /src/gui/painting
parentdeffb8578757550e57ea3058e95a758155632226 (diff)
downloadQt-ed21b9dafea192ddd39f1d2a4abcb54962d6dfb8.zip
Qt-ed21b9dafea192ddd39f1d2a4abcb54962d6dfb8.tar.gz
Qt-ed21b9dafea192ddd39f1d2a4abcb54962d6dfb8.tar.bz2
Sometimes wrong clipping in QWidget::render() when passing a device or
an untransformed painter When passing a painter to QWidget::render, we use the painter->paintEngine()->systemClip() as the "system viewport", i.e. all painting triggered by render() should be limited to this area. The only way to achieve this is by always ensuring the system clip is clipped to the same area (systemClip &= systemViewport). The problem however, was that we only did this for transformed painters. We must of course always do it when there's a systemViewport set, regardless of whether the painter is transformed or not. Auto test included. Task-number: 248852 Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpaintengine.cpp4
-rw-r--r--src/gui/painting/qpaintengine_p.h12
2 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index ad09060..7de1ec4 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -949,8 +949,8 @@ void QPaintEngine::setSystemClip(const QRegion &region)
Q_D(QPaintEngine);
d->systemClip = region;
// Be backward compatible and only call d->systemStateChanged()
- // if we currently have a system transform set.
- if (d->hasSystemTransform) {
+ // if we currently have a system transform/viewport set.
+ if (d->hasSystemTransform || d->hasSystemViewport) {
d->transformSystemClip();
d->systemStateChanged();
}
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index eeba7ec..0b5e175 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -83,10 +83,12 @@ public:
if (systemClip.isEmpty())
return;
- if (systemTransform.type() <= QTransform::TxTranslate)
- systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy()));
- else
- systemClip = systemTransform.map(systemClip);
+ if (hasSystemTransform) {
+ if (systemTransform.type() <= QTransform::TxTranslate)
+ systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy()));
+ else
+ systemClip = systemTransform.map(systemClip);
+ }
// Make sure we're inside the viewport.
if (hasSystemViewport) {
@@ -101,7 +103,7 @@ public:
inline void setSystemTransform(const QTransform &xform)
{
systemTransform = xform;
- if ((hasSystemTransform = !xform.isIdentity()))
+ if ((hasSystemTransform = !xform.isIdentity()) || hasSystemViewport)
transformSystemClip();
systemStateChanged();
}