Warning, /graphics/krita/3rdparty/ext_qt/Make-QQuickWindow-renderer-follow-real-logical-size.patch is written in an unsupported language. File is not indexed.

0001 From 97e5ed4ecec4ef612f6c8070823dbcb57fb58869 Mon Sep 17 00:00:00 2001
0002 From: Alvin Wong <alvinhochun@gmail.com>
0003 Date: Thu, 3 Mar 2022 00:43:35 +0800
0004 Subject: [PATCH] Make QQuickWindow renderer follow real logical size
0005  accurately
0006 
0007 Use QSizeF(pixelSize) / devicePixelRatio instead of incorrectly rounded
0008 versions. Also simplified the size manipulation by following some of
0009 what has been done in 17a280995ab546074fa7e9a009642fec5f23c64e:
0010 https://codereview.qt-project.org/c/qt/qtdeclarative/+/394497
0011 
0012 This patch is necessary to have the projection matrix be set up
0013 correctly in a way that would allow easy pixel-perfect item placement
0014 and rendering in a QtQUick2 scene, when the high-DPI scaling
0015 (devicePixelRatio) is non-integer.
0016 ---
0017  src/quick/items/qquickwindow.cpp | 24 ++++++++----------------
0018  1 file changed, 8 insertions(+), 16 deletions(-)
0019 
0020 diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
0021 index 3c97475e86..5d3e771fcd 100644
0022 --- a/src/quick/items/qquickwindow.cpp
0023 +++ b/src/quick/items/qquickwindow.cpp
0024 @@ -540,25 +540,17 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size)
0025      if (!customRenderStage || !customRenderStage->render()) {
0026          int fboId = 0;
0027          const qreal devicePixelRatio = q->effectiveDevicePixelRatio();
0028 +        QSize pixelSize;
0029          if (renderTargetId) {
0030 -            QRect rect(QPoint(0, 0), renderTargetSize);
0031 -            fboId = renderTargetId;
0032 -            renderer->setDeviceRect(rect);
0033 -            renderer->setViewportRect(rect);
0034 -            if (QQuickRenderControl::renderWindowFor(q)) {
0035 -                renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size));
0036 -                renderer->setDevicePixelRatio(devicePixelRatio);
0037 -            } else {
0038 -                renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), rect.size()));
0039 -                renderer->setDevicePixelRatio(1);
0040 -            }
0041 +            pixelSize = renderTargetSize;
0042          } else {
0043 -            QRect rect(QPoint(0, 0), devicePixelRatio * size);
0044 -            renderer->setDeviceRect(rect);
0045 -            renderer->setViewportRect(rect);
0046 -            renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size));
0047 -            renderer->setDevicePixelRatio(devicePixelRatio);
0048 +            pixelSize = size * devicePixelRatio;
0049          }
0050 +        QSizeF logicalSize = QSizeF(pixelSize) / devicePixelRatio;
0051 +        renderer->setDevicePixelRatio(devicePixelRatio);
0052 +        renderer->setDeviceRect(QRect(QPoint(0, 0), pixelSize));
0053 +        renderer->setViewportRect(QRect(QPoint(0, 0), pixelSize));
0054 +        renderer->setProjectionMatrixToRect(QRectF(QPointF(0, 0), logicalSize));
0055  
0056          context->renderNextFrame(renderer, fboId);
0057      }
0058 -- 
0059 2.24.1.windows.2
0060