Ensure that translations never change the size of a contrast effect / blur regions

BUG:480434
wilder/Plasma/6.2
Niccolò Venerandi 2 years ago committed by Vlad Zahorodnii
parent f349d8e132
commit 7732f0e56b
  1. 9
      src/plugins/backgroundcontrast/contrast.cpp
  2. 9
      src/plugins/blur/blur.cpp

@ -417,14 +417,7 @@ void ContrastEffect::drawWindow(const RenderTarget &renderTarget, const RenderVi
// Only translated, not scaled
} else if (translated) {
QRegion translated;
for (QRect r : shape) {
const QRectF t = QRectF(r).translated(data.xTranslation(), data.yTranslation());
const QPoint topLeft(std::ceil(t.x()), std::ceil(t.y()));
const QPoint bottomRight(std::floor(t.x() + t.width() - 1), std::floor(t.y() + t.height() - 1));
translated += QRect(topLeft, bottomRight);
}
shape = translated & region;
shape.translate(std::round(data.xTranslation()), std::round(data.yTranslation()));
}
if (!shape.isEmpty()) {

@ -550,14 +550,7 @@ void BlurEffect::blur(const RenderTarget &renderTarget, const RenderViewport &vi
}
blurShape = scaledShape;
} else if (data.xTranslation() || data.yTranslation()) {
QRegion translated;
for (const QRect &r : blurShape) {
const QRectF t = QRectF(r).translated(data.xTranslation(), data.yTranslation());
const QPoint topLeft(std::ceil(t.x()), std::ceil(t.y()));
const QPoint bottomRight(std::floor(t.x() + t.width() - 1), std::floor(t.y() + t.height() - 1));
translated += QRect(topLeft, bottomRight);
}
blurShape = translated;
blurShape.translate(std::round(data.xTranslation()), std::round(data.yTranslation()));
}
const QRect backgroundRect = blurShape.boundingRect();

Loading…
Cancel
Save