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.
This commit is contained in:
parent
e27ecfe88d
commit
4326d3f029
1 changed files with 15 additions and 13 deletions
|
@ -542,20 +542,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;
|
||||
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;
|
||||
// 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
|
||||
|
|
Loading…
Reference in a new issue