Commit 9cf586d6 authored by Antti Määttä's avatar Antti Määttä Committed by Albert Astals Cid
Browse files

Widgets: Use effect region bounds when drawing with repaint manager



When drawing widgets with graphics effect using repaint manager,
if we do not combine the effect region some child widgets are not
affected by the graphics effect since they are not included in the dirty
region. However always using region bounds breaks the referenced bug use case.

Fixes: QTBUG-102374
Pick-to: 6.3 6.2 5.15
Change-Id: Iaf4eaba34db863500a0600b344e5062f2b36b9bf
Reviewed-by: Volker Hilsheimer's avatarVolker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a382134a)
parent f5f4260b
......@@ -5296,7 +5296,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
(source->d_func());
if (!sourced->context) {
const QRegion effectRgn(rgn.boundingRect());
const QRegion effectRgn((flags & UseEffectRegionBounds) ? rgn.boundingRect() : rgn);
QWidgetPaintContext context(pdev, effectRgn, offset, flags, sharedPainter, repaintManager);
sourced->context = &context;
if (!sharedPainter) {
......@@ -5328,6 +5328,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
}
}
#endif // QT_CONFIG(graphicseffect)
flags = flags & ~UseEffectRegionBounds;
const bool alsoOnScreen = flags & DrawPaintOnScreen;
const bool recursive = flags & DrawRecursive;
......
......@@ -229,7 +229,8 @@ public:
DontSubtractOpaqueChildren = 0x10,
DontDrawOpaqueChildren = 0x20,
DontDrawNativeChildren = 0x40,
DontSetCompositionMode = 0x80
DontSetCompositionMode = 0x80,
UseEffectRegionBounds = 0x100
};
Q_DECLARE_FLAGS(DrawWidgetFlags, DrawWidgetFlag)
Q_FLAG(DrawWidgetFlags)
......
......@@ -1018,7 +1018,8 @@ void QWidgetRepaintManager::paintAndFlush()
// Paint the rest with composition.
if (repaintAllWidgets || !dirtyCopy.isEmpty()) {
QWidgetPrivate::DrawWidgetFlags flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive;
QWidgetPrivate::DrawWidgetFlags flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive
| QWidgetPrivate::UseEffectRegionBounds;
tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, QPoint(), flags, nullptr, this);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment