diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-02 16:42:33 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-03 09:38:11 +0200 |
commit | 5bc1ae578ed79ef295e86901e4620d9c37687ed7 (patch) | |
tree | 39bce8d408bf813e018b7f802c53f112d8d4b935 /src/quick/scenegraph/qsgcontext.cpp | |
parent | ee9319f63c2e9d307bcda41669aaed9934d013ad (diff) |
Fix device pixel ratio with QRhi for native text
Calculating values based on the dpr is not possible in the sync phase,
because the strictly correct dpr (that takes redirections into textures
into account) is not known until QQuickWindowPrivate::renderSceneGraph().
The text material implementation attempts to dig out something directly
from the context's associated surface, but this does not match the way
QQuickWindow calculates the value (although it would work without causing
any trouble in many cases).
This is of course incompatible with the QRhi-based abstraction since
neither the context nor the associated window (if there is one even) is
known to materials.
To solve this, create a proper solution that makes the
QQuickWindow-calculated dpr available already in the sync phase (so in
updatePaintNode() implementations): have QQuickWindow calculate
calculate the dpr in syncSceneGraph(), and pass it down via the
rendercontext.
Only the rhi-based code path is touched in this patch. The direct OpenGL
path could be fixed in a similar manner (by migrating to
rc->devicePixelRatio() in the sync phase and state.devicePixelRatio() in
the render phase), but that is left as a future exercise.
Task-number: QTBUG-78610
Change-Id: Id9d9d4b1fd5b9730a64834fbbf61c74af4a8ed07
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgcontext.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 97fd49e4c7..17eb1e312c 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -341,6 +341,11 @@ void QSGRenderContext::invalidate() { } +void QSGRenderContext::prepareSync(qreal devicePixelRatio) +{ + Q_UNUSED(devicePixelRatio); +} + void QSGRenderContext::beginNextFrame(QSGRenderer *renderer, RenderPassCallback mainPassRecordingStart, RenderPassCallback mainPassRecordingEnd, |