diff options
author | Laszlo Agocs <[email protected]> | 2025-06-02 12:44:59 +0200 |
---|---|---|
committer | Tor Arne Vestbø <[email protected]> | 2025-06-02 14:44:30 +0000 |
commit | d96f616722fc7b3f49ae671ecd20f50517920a96 (patch) | |
tree | 164cba579a4e88c4bee6c9b0281697c7556398a2 | |
parent | 70a38fc67a5a8e311939b24f386addee642c766a (diff) |
The scenegraph is not initialized when the window has not been
exposed yet, and calling QQuickWindow::grabWindow() takes a whole
different code path in this case. This was not communicating a
scale factor to the renderer at all.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-116675
Change-Id: I73b21dfd06a04dbdc2ff3cb1a17bbe0364ca0624
Reviewed-by: Tor Arne Vestbø <[email protected]>
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 6e773b4c32..fa325f8b3e 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -1393,7 +1393,11 @@ QImage QSGRhiSupport::grabOffscreen(QQuickWindow *window) // There was no rendercontrol which means a custom render target // should not be set either. Set our own, temporarily. - window->setRenderTarget(QQuickRenderTarget::fromRhiRenderTarget(rt.data())); + auto renderTarget = QQuickRenderTarget::fromRhiRenderTarget(rt.data()); + // Pass on the scale factor. No need to use effectiveDevicePixelRatio(), + // because there is no rendercontrol anyway. + renderTarget.setDevicePixelRatio(window->devicePixelRatio()); + window->setRenderTarget(renderTarget); QRhiCommandBuffer *cb = nullptr; if (rhi->beginOffscreenFrame(&cb) != QRhi::FrameOpSuccess) { |