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

BUG:480434
This commit is contained in:
Niccolò Venerandi 2024-01-30 13:58:58 +01:00 committed by Vlad Zahorodnii
parent f349d8e132
commit 7732f0e56b
2 changed files with 2 additions and 16 deletions

View file

@ -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()) {

View file

@ -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();