From ea3ede9c45748aa8bc1dee572be2570f83fbcb95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 15 Oct 2021 08:23:22 +0300 Subject: 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 Reviewed-by: Volker Hilsheimer --- src/widgets/kernel/qwidget.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/widgets') 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 (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; } -- cgit v1.2.3