aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/shaders/outlinedtext_core.vert
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2019-11-15 16:44:20 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2019-11-18 09:48:44 +0000
commitaf090d8073a4352f6a92bbe2d015ae87476684c7 (patch)
tree0ea1b145fce2fb700fa524fbce24ed43815a4c03 /src/quick/scenegraph/shaders/outlinedtext_core.vert
parent9b2af0c5f581797e0098494efa93365a2dc6d0bf (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/outlinedtext_core.vert')
-rw-r--r--src/quick/scenegraph/shaders/outlinedtext_core.vert4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/scenegraph/shaders/outlinedtext_core.vert b/src/quick/scenegraph/shaders/outlinedtext_core.vert
index 4aa13101fd..ae945b013a 100644
--- a/src/quick/scenegraph/shaders/outlinedtext_core.vert
+++ b/src/quick/scenegraph/shaders/outlinedtext_core.vert
@@ -12,6 +12,7 @@ out vec2 sCoordRight;
uniform mat4 matrix;
uniform vec2 textureScale;
uniform vec2 shift;
+uniform float dpr;
void main()
{
@@ -20,5 +21,6 @@ void main()
sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale;
sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale;
sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale;
- gl_Position = matrix * vCoord;
+ vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr;
+ gl_Position = matrix * vec4(dprSnapPos, vCoord.w);
} \ No newline at end of file