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.
master
Vlad Zahorodnii 2020-09-01 00:03:54 +03:00
parent ed113171f3
commit b2792ae3cd
1 changed files with 4 additions and 4 deletions

View File

@ -127,7 +127,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
}
data.translate(-interpolate(qMin(geo.width(), slideLength), 0.0, t));
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;
case Location::Top:
if (slideLength < geo.height()) {
@ -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));
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;
case Location::Right:
if (slideLength < geo.width()) {
@ -143,7 +143,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow *w, int mask, QRegion region,
}
data.translate(interpolate(qMin(geo.width(), slideLength), 0.0, t));
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;
case Location::Bottom:
default:
@ -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));
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);