[effects/slidingpopups] Don't filter window quads

Summary:
Slided popups are clipped twice:
* first, when filtering window quads in prePaintWindow;
* then, when doing scissor test (the opengl scene plugin does scissor
test for transformed windows).

Because of that, we don't need to filter window quads. Filtering window
quads only adds overhead.

This change simplifies code and "fixes" incorrect clipping when a slided
popup has shadows.

Test Plan:
* Put Plasma panel on the left screen edge;
* Open and close the Application Launcher.

(repeat for top/right/bottom screen edge)

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14450
This commit is contained in:
Vlad Zagorodniy 2018-07-29 11:29:14 +03:00
parent 304528e80b
commit 4a38f15d90

View file

@ -103,76 +103,6 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
data.setTransformed(); data.setTransformed();
w->enablePainting(EffectWindow::PAINT_DISABLED | EffectWindow::PAINT_DISABLED_BY_DELETE); w->enablePainting(EffectWindow::PAINT_DISABLED | EffectWindow::PAINT_DISABLED_BY_DELETE);
const int start = mWindowsData[ w ].start;
if (start != 0) {
const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), effects->currentDesktop());
const QRect geo = w->expandedGeometry();
const qreal t = (*animationIt).timeLine.value();
// filter out window quads, but only if the window does not start from the edge
int slideLength;
if (mWindowsData[ w ].slideLength > 0) {
slideLength = mWindowsData[ w ].slideLength;
} else {
slideLength = mSlideLength;
}
switch(mWindowsData[ w ].from) {
case West: {
const double splitPoint = geo.width() - (geo.x() + geo.width() - screenRect.x() - start) + interpolate(qMin(geo.width(), slideLength), 0, t);
data.quads = data.quads.splitAtX(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
for (const WindowQuad &quad : qAsConst(data.quads)) {
if (quad.left() >= splitPoint) {
filtered << quad;
}
}
data.quads = filtered;
break;
}
case North: {
const double splitPoint = geo.height() - (geo.y() + geo.height() - screenRect.y() - start) + interpolate(qMin(geo.height(), slideLength), 0, t);
data.quads = data.quads.splitAtY(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
for (const WindowQuad &quad : qAsConst(data.quads)) {
if (quad.top() >= splitPoint) {
filtered << quad;
}
}
data.quads = filtered;
break;
}
case East: {
const double splitPoint = screenRect.x() + screenRect.width() - geo.x() - start - interpolate(qMin(geo.width(), slideLength), 0, t);
data.quads = data.quads.splitAtX(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
for (const WindowQuad &quad : qAsConst(data.quads)) {
if (quad.right() <= splitPoint) {
filtered << quad;
}
}
data.quads = filtered;
break;
}
case South:
default: {
const double splitPoint = screenRect.y() + screenRect.height() - geo.y() - start - interpolate(qMin(geo.height(), slideLength), 0, t);
data.quads = data.quads.splitAtY(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
for (const WindowQuad &quad : qAsConst(data.quads)) {
if (quad.bottom() <= splitPoint) {
filtered << quad;
}
}
data.quads = filtered;
break;
}
}
}
effects->prePaintWindow(w, data, time); effects->prePaintWindow(w, data, time);
} }