diff options
author | Antti Määttä <antti.maatta@qt.io> | 2021-10-15 08:23:22 +0300 |
---|---|---|
committer | Antti Määttä <antti.maatta@qt.io> | 2021-10-27 14:32:35 +0300 |
commit | ea3ede9c45748aa8bc1dee572be2570f83fbcb95 (patch) | |
tree | 8986303329e41f9a2b15dac0aa1f0ac5603a21a5 /src | |
parent | 11999a0aafa20bb733edea4a7a6093c2581a1c89 (diff) |
Calculate effect bounds when drawing widget graphics effect
Calculate effect bounds for the updated region when drawing the effect
so that the whole affected area gets updated. The effect bounds have
already been added to the region so it doesn't need to be handled in
the drawing function.
Pick-to: 6.2 5.15
Fixes: QTBUG-96240
Change-Id: I0c317311622e6299fb1a3015541408d1d83c93de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index e6b49e8c45..283c6b00a1 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5463,10 +5463,11 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *> (source->d_func()); if (!sourced->context) { - QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, repaintManager); + const QRegion effectRgn(rgn.boundingRect()); + QWidgetPaintContext context(pdev, effectRgn, offset, flags, sharedPainter, repaintManager); sourced->context = &context; if (!sharedPainter) { - setSystemClip(pdev->paintEngine(), pdev->devicePixelRatio(), rgn.translated(offset)); + setSystemClip(pdev->paintEngine(), pdev->devicePixelRatio(), effectRgn.translated(offset)); QPainter p(pdev); p.translate(offset); context.painter = &p; @@ -5480,7 +5481,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } sharedPainter->save(); sharedPainter->translate(offset); - setSystemClip(sharedPainter->paintEngine(), sharedPainter->device()->devicePixelRatio(), rgn.translated(offset)); + setSystemClip(sharedPainter->paintEngine(), sharedPainter->device()->devicePixelRatio(), effectRgn.translated(offset)); graphicsEffect->draw(sharedPainter); setSystemClip(sharedPainter->paintEngine(), 1, QRegion()); sharedPainter->restore(); @@ -5488,7 +5489,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP sourced->context = nullptr; if (repaintManager) - repaintManager->markNeedsFlush(q, rgn, offset); + repaintManager->markNeedsFlush(q, effectRgn, offset); return; } |