diff options
author | Bjoern Erik Nilsen <bnilsen@trolltech.com> | 2009-04-24 15:34:28 (GMT) |
---|---|---|
committer | Bjoern Erik Nilsen <bnilsen@trolltech.com> | 2009-04-24 15:34:28 (GMT) |
commit | ed21b9dafea192ddd39f1d2a4abcb54962d6dfb8 (patch) | |
tree | 62bb3042bc91353c3e6293ad7eb48a3389b0fb69 /src/gui/kernel/qwidget.cpp | |
parent | deffb8578757550e57ea3058e95a758155632226 (diff) | |
download | Qt-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/kernel/qwidget.cpp')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 071e1bd..e9fd28b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4709,10 +4709,13 @@ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, if (redirected) { target = redirected; offset -= redirectionOffset; - if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp). - const QRegion redirectedSystemClip = redirected->paintEngine()->systemClip(); - if (!redirectedSystemClip.isEmpty()) - paintRegion &= redirectedSystemClip.translated(-offset); + } + + if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp). + if (QPaintEngine *targetEngine = target->paintEngine()) { + const QRegion targetSystemClip = targetEngine->systemClip(); + if (!targetSystemClip.isEmpty()) + paintRegion &= targetSystemClip.translated(-offset); } } |