Commit 00a8de6c authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

effects/blur: Avoid shrinking unrelated opaque regions

Currently, the blur effect will shrink an opaque region even if it
doesn't intersect m_currentBlur.

This ensures that the blur effect won't do a stupid thing such as
clipping the opaque region of the desktop window.


(cherry picked from commit 4326d3f0)
parent 5e448f06
Pipeline #140606 passed with stage
in 14 minutes and 46 seconds
......@@ -509,20 +509,22 @@ void BlurEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std::
return;
}
// 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);
}
data.clip = newClip;
// 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 (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);
}
data.clip = newClip;
// 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;
}
}
// in case this window has regions to be blurred
......
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