effects/backgroundcontrast: Fix backgroundcontrast stripes when rounded window scaling

This commit is contained in:
Mouse Zhang 2022-10-21 17:55:27 +08:00 committed by Vlad Zahorodnii
parent 8468eeafdd
commit fcaf0cad9e

View file

@ -18,6 +18,7 @@
#include <QMatrix4x4> #include <QMatrix4x4>
#include <QTimer> #include <QTimer>
#include <QWindow> #include <QWindow>
#include <cmath> // for ceil()
namespace KWin namespace KWin
{ {
@ -381,8 +382,8 @@ void ContrastEffect::drawWindow(EffectWindow *w, int mask, const QRegion &region
for (QRect r : shape) { for (QRect r : shape) {
r.moveTo(pt.x() + (r.x() - pt.x()) * data.xScale() + data.xTranslation(), r.moveTo(pt.x() + (r.x() - pt.x()) * data.xScale() + data.xTranslation(),
pt.y() + (r.y() - pt.y()) * data.yScale() + data.yTranslation()); pt.y() + (r.y() - pt.y()) * data.yScale() + data.yTranslation());
r.setWidth(r.width() * data.xScale()); r.setWidth(std::ceil(r.width() * data.xScale()));
r.setHeight(r.height() * data.yScale()); r.setHeight(std::ceil(r.height() * data.yScale()));
scaledShape |= r; scaledShape |= r;
} }
shape = scaledShape & region; shape = scaledShape & region;