effects/blur: Fix window flickering when the clip intersected with the current blur region.

This fixes a bug introduced in https://invent.kde.org/plasma/kwin/-/merge_requests/2045 where it would no longer check if it should redraw the whole region unless the data clip intersected. This would lead to flickering in certain cases

BUG: 421135
This commit is contained in:
Mathias Tillman 2022-03-17 22:19:55 +00:00 committed by David Edmundson
parent 927714466c
commit 140c2fb20e

View file

@ -542,10 +542,10 @@ void BlurEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std::
return;
}
const QRegion oldClip = data.clip;
if (data.clip.intersects(m_currentBlur)) {
// to blur an area partially we have to shrink the opaque area of a window
QRegion newClip;
const QRegion oldClip = data.clip;
for (const QRect &rect : data.clip) {
newClip |= rect.adjusted(m_expandSize, m_expandSize, -m_expandSize, -m_expandSize);
}
@ -553,11 +553,12 @@ void BlurEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std::
// we don't have to blur a region we don't see
m_currentBlur -= newClip;
// if we have to paint a non-opaque part of this window that intersects with the
// currently blurred region we have to redraw the whole region
if ((data.paint - oldClip).intersects(m_currentBlur)) {
data.paint |= m_currentBlur;
}
}
// if we have to paint a non-opaque part of this window that intersects with the
// currently blurred region we have to redraw the whole region
if ((data.paint - oldClip).intersects(m_currentBlur)) {
data.paint |= m_currentBlur;
}
// in case this window has regions to be blurred