diff options
author | Antti Määttä <antti.maatta@qt.io> | 2022-10-20 14:03:25 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-10-21 08:54:03 +0000 |
commit | 2911984f24439949d96ff03c1436f3eccabc5c8b (patch) | |
tree | 0ba59391ced1e833f0b84140d132e4b01d120469 | |
parent | 1ce362250f1c591b2c785a4a86f35fb8785ff018 (diff) |
Fix projection matrix to correct viewport size
When device pixel ratio is not 1.0, the projection matrix can
be incorrect because it uses floating point values when calculating
it, which can have fractional values.
Fix calculating projection matrix by rounding the logical pixel
size after dpr division. We don't render to fractional pixels so the
parameters to setProjectionMatrixToRect can't be fractional either.
Fixes white lines at the edges of the window.
Fixes: QTBUG-95225
Change-Id: I85039ead5f31fb251c6cf760aa0b55b4b2a9e29d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 530f21c69e17db7f9210a033106edde5a7769af8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 77d2827536..66ab8158a6 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -652,7 +652,7 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size, const QSize &surfa pixelSize = size * devicePixelRatio; else pixelSize = surfaceSize; - QSizeF logicalSize = QSizeF(pixelSize) / devicePixelRatio; + QSize logicalSize = pixelSize / devicePixelRatio; renderer->setDevicePixelRatio(devicePixelRatio); renderer->setDeviceRect(QRect(QPoint(0, 0), pixelSize)); |