diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-11-15 16:44:20 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-11-18 09:48:44 +0000 |
commit | af090d8073a4352f6a92bbe2d015ae87476684c7 (patch) | |
tree | 0ea1b145fce2fb700fa524fbce24ed43815a4c03 /src/quick/scenegraph/shaders/styledtext_core.vert | |
parent | 9b2af0c5f581797e0098494efa93365a2dc6d0bf (diff) |
Fix: NativeRendering text for non-integer screen scaling
Commit 6e883c53 introduced snapping to pixel grid for non-integer
device pixel ratios. But the snapping also modified the w element of
the coord vector, which resulted in mangled and offset rendering.
As a driveby, add the dpr snapping also to the outlinetext shader, as
it improves rendering quality.
Fixes: QTBUG-70481
Fixes: QTBUG-78160
Change-Id: I4c4b1788005514adc0255878ba24cdf1acc6755f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/quick/scenegraph/shaders/styledtext_core.vert')
-rw-r--r-- | src/quick/scenegraph/shaders/styledtext_core.vert | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/scenegraph/shaders/styledtext_core.vert b/src/quick/scenegraph/shaders/styledtext_core.vert index c522877bb3..7e313eb797 100644 --- a/src/quick/scenegraph/shaders/styledtext_core.vert +++ b/src/quick/scenegraph/shaders/styledtext_core.vert @@ -15,5 +15,6 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - gl_Position = matrix * round(vCoord * dpr) / dpr; + vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } |