Commit b2792ae3 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

effects/slidingpopups: Properly clip windows

The region that we pass to the next paintWindow() cannot be larger than
the one that we've received. If an effect passes a larger region, the
tracked buffer damage will be messed up and user will see all sorts of
visual artifacts.
parent ed113171
...@@ -127,7 +127,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region, ...@@ -127,7 +127,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
} }
data.translate(-interpolate(qMin(geo.width(), slideLength), 0.0, t)); data.translate(-interpolate(qMin(geo.width(), slideLength), 0.0, t));
splitPoint = geo.width() - (geo.x() + geo.width() - screenRect.x() - animData.offset); splitPoint = geo.width() - (geo.x() + geo.width() - screenRect.x() - animData.offset);
region = QRegion(geo.x() + splitPoint, geo.y(), geo.width() - splitPoint, geo.height()); region &= QRegion(geo.x() + splitPoint, geo.y(), geo.width() - splitPoint, geo.height());
break; break;
case Location::Top: case Location::Top:
if (slideLength < geo.height()) { if (slideLength < geo.height()) {
...@@ -135,7 +135,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region, ...@@ -135,7 +135,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
} }
data.translate(0.0, -interpolate(qMin(geo.height(), slideLength), 0.0, t)); data.translate(0.0, -interpolate(qMin(geo.height(), slideLength), 0.0, t));
splitPoint = geo.height() - (geo.y() + geo.height() - screenRect.y() - animData.offset); splitPoint = geo.height() - (geo.y() + geo.height() - screenRect.y() - animData.offset);
region = QRegion(geo.x(), geo.y() + splitPoint, geo.width(), geo.height() - splitPoint); region &= QRegion(geo.x(), geo.y() + splitPoint, geo.width(), geo.height() - splitPoint);
break; break;
case Location::Right: case Location::Right:
if (slideLength < geo.width()) { if (slideLength < geo.width()) {
...@@ -143,7 +143,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region, ...@@ -143,7 +143,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
} }
data.translate(interpolate(qMin(geo.width(), slideLength), 0.0, t)); data.translate(interpolate(qMin(geo.width(), slideLength), 0.0, t));
splitPoint = screenRect.x() + screenRect.width() - geo.x() - animData.offset; splitPoint = screenRect.x() + screenRect.width() - geo.x() - animData.offset;
region = QRegion(geo.x(), geo.y(), splitPoint, geo.height()); region &= QRegion(geo.x(), geo.y(), splitPoint, geo.height());
break; break;
case Location::Bottom: case Location::Bottom:
default: default:
...@@ -152,7 +152,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region, ...@@ -152,7 +152,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
} }
data.translate(0.0, interpolate(qMin(geo.height(), slideLength), 0.0, t)); data.translate(0.0, interpolate(qMin(geo.height(), slideLength), 0.0, t));
splitPoint = screenRect.y() + screenRect.height() - geo.y() - animData.offset; splitPoint = screenRect.y() + screenRect.height() - geo.y() - animData.offset;
region = QRegion(geo.x(), geo.y(), geo.width(), splitPoint); region &= QRegion(geo.x(), geo.y(), geo.width(), splitPoint);
} }
effects->paintWindow(w, mask, region, data); effects->paintWindow(w, mask, region, data);
......
Markdown is supported
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