From b2792ae3cdfdc7e19e360377218f6ad045345ba9 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 1 Sep 2020 00:03:54 +0300 Subject: [PATCH] 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. --- effects/slidingpopups/slidingpopups.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/effects/slidingpopups/slidingpopups.cpp b/effects/slidingpopups/slidingpopups.cpp index f9fd0078ca..45e28a84e8 100644 --- a/effects/slidingpopups/slidingpopups.cpp +++ b/effects/slidingpopups/slidingpopups.cpp @@ -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);