Fix weird decoration glitch when using a scaled display

We used to get a weird line around the window decoration because the
clamping would hit the outside of the rendered decoration.
To make sure we fall inside take the displayPixelRatio into account.
Also on non-integer scales, make sure we are actually falling inside.
This commit is contained in:
Aleix Pol 2021-05-29 04:35:52 +02:00 committed by Aleix Pol Gonzalez
parent 7bf79090cf
commit aba3335ea6

View file

@ -2588,7 +2588,9 @@ void SceneOpenGLDecorationRenderer::render(const QRegion &region)
renderToPainter(&painter, geo);
painter.end();
clamp(image, QRect(viewport.topLeft(), viewport.size() * devicePixelRatio));
const QRect viewportScaled(viewport.topLeft() * devicePixelRatio, viewport.size() * devicePixelRatio);
const bool isIntegerScaling = qFuzzyCompare(devicePixelRatio, std::ceil(devicePixelRatio));
clamp(image, isIntegerScaling ? viewportScaled : viewportScaled.marginsRemoved({1, 1, 1, 1}));
if (rotated) {
// TODO: get this done directly when rendering to the image