aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2023-02-28 12:48:30 +0100
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-01 08:40:18 +0000
commit0a8a7521ed395f385d111aa602f9c7b8d09ca991 (patch)
treef654a2edbf7206b0be3c501fe5260e3c3671e472
parent261624e2d44ce9db0cb81abb230942becdb32af8 (diff)
Revert "Fix "white line on top and left side of screen" issue"
This reverts commit 2a6897b9cee24c1631655c02cd41c3640e9d807a. This caused a regression on iOS where Qt painted to the bottom left quarter of the app window only. Fixes: QTBUG-111542 Change-Id: I9c56e410994966d01a29dfea45e5aec1f3e5a106 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
-rw-r--r--src/quick/items/qquickwindow.cpp12
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp12
2 files changed, 11 insertions, 13 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 5d993e4698..c6c7b6171e 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -591,7 +591,15 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size, const QSize &surfa
renderer->setDevicePixelRatio(1);
}
} else {
- const QSize pixelSize = surfaceSize.isEmpty() ? size * devicePixelRatio : surfaceSize;
+ QSize pixelSize;
+ QSizeF logicalSize;
+ if (surfaceSize.isEmpty()) {
+ pixelSize = size * devicePixelRatio;
+ logicalSize = size;
+ } else {
+ pixelSize = surfaceSize;
+ logicalSize = QSizeF(surfaceSize) / devicePixelRatio;
+ }
QRect rect(QPoint(0, 0), pixelSize);
renderer->setDeviceRect(rect);
renderer->setViewportRect(rect);
@@ -599,7 +607,7 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size, const QSize &surfa
QSGAbstractRenderer::MatrixTransformFlags matrixFlags;
if (flipY)
matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY;
- renderer->setProjectionMatrixToRect(QRectF(QPoint(0, 0), size), matrixFlags);
+ renderer->setProjectionMatrixToRect(QRectF(QPoint(0, 0), logicalSize), matrixFlags);
renderer->setDevicePixelRatio(devicePixelRatio);
}
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 457e362b80..da0e8bdc7c 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -368,7 +368,6 @@ public:
QQuickWindow *window; // Will be 0 when window is not exposed
QSize windowSize;
- QSize windowPixelSize;
float dpr = 1;
int rhiSampleCount = 1;
bool rhiDeviceLost = false;
@@ -407,8 +406,6 @@ bool QSGRenderThread::event(QEvent *e)
stopEventProcessing = true;
window = se->window;
windowSize = se->size;
- if (window)
- windowPixelSize = window->handle()->geometry().size();
dpr = se->dpr;
pendingUpdate |= SyncRequest;
@@ -836,14 +833,7 @@ void QSGRenderThread::syncAndRender(QImage *grabImage)
}
}
if (current) {
- const QSize surfaceSize = [this, cd]{
- if (rhi)
- return cd->swapchain->currentPixelSize();
- if (windowPixelSize.isValid())
- return windowPixelSize;
- return QSize();
- }();
- d->renderSceneGraph(windowSize, surfaceSize);
+ d->renderSceneGraph(windowSize, rhi ? cd->swapchain->currentPixelSize() : QSize());
if (profileFrames)
renderTime = threadTimer.nsecsElapsed();