aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/shaders
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@sletta.org>2014-10-23 11:28:22 +0200
committerGunnar Sletta <gunnar@sletta.org>2014-10-23 12:06:57 +0200
commit6e883c535b91c55289d54aa639199ca0a4decaec (patch)
tree05903e82d27339da160c4ba0ea8030a9d1b8618c /src/quick/scenegraph/shaders
parente3c6f39734ff54b2d7425f2edaaf6033ef2b1d9e (diff)
Fix pixelgrid snapping of native text on retina displays.
Change 63e6c9ada82dc8f16e705cef5f89292784b7ace4 introduced snapping to the pixel grid in the vertex shader for native text, but this code was broken on retina displays because it assumed integer only positions. Fix it by including the retina scale factor into the rounding. Task-number: QTBUG-38702 Change-Id: I84492b02d64f263c9fe030790e04cf79b0dc4e2f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/quick/scenegraph/shaders')
-rw-r--r--src/quick/scenegraph/shaders/styledtext.vert3
-rw-r--r--src/quick/scenegraph/shaders/styledtext_core.vert3
-rw-r--r--src/quick/scenegraph/shaders/textmask.vert3
-rw-r--r--src/quick/scenegraph/shaders/textmask_core.vert3
4 files changed, 8 insertions, 4 deletions
diff --git a/src/quick/scenegraph/shaders/styledtext.vert b/src/quick/scenegraph/shaders/styledtext.vert
index 14fefc2564..7001bbc262 100644
--- a/src/quick/scenegraph/shaders/styledtext.vert
+++ b/src/quick/scenegraph/shaders/styledtext.vert
@@ -1,6 +1,7 @@
uniform highp mat4 matrix;
uniform highp vec2 textureScale;
uniform highp vec2 shift;
+uniform highp float dpr;
attribute highp vec4 vCoord;
attribute highp vec2 tCoord;
@@ -12,5 +13,5 @@ void main()
{
sampleCoord = tCoord * textureScale;
shiftedSampleCoord = (tCoord - shift) * textureScale;
- gl_Position = matrix * floor(vCoord + 0.5);
+ gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr;
}
diff --git a/src/quick/scenegraph/shaders/styledtext_core.vert b/src/quick/scenegraph/shaders/styledtext_core.vert
index 65bdb66814..c522877bb3 100644
--- a/src/quick/scenegraph/shaders/styledtext_core.vert
+++ b/src/quick/scenegraph/shaders/styledtext_core.vert
@@ -9,10 +9,11 @@ out vec2 shiftedSampleCoord;
uniform mat4 matrix;
uniform vec2 textureScale;
uniform vec2 shift;
+uniform float dpr;
void main()
{
sampleCoord = tCoord * textureScale;
shiftedSampleCoord = (tCoord - shift) * textureScale;
- gl_Position = matrix * round(vCoord);
+ gl_Position = matrix * round(vCoord * dpr) / dpr;
}
diff --git a/src/quick/scenegraph/shaders/textmask.vert b/src/quick/scenegraph/shaders/textmask.vert
index dd8918839e..4c678270d0 100644
--- a/src/quick/scenegraph/shaders/textmask.vert
+++ b/src/quick/scenegraph/shaders/textmask.vert
@@ -1,5 +1,6 @@
uniform highp mat4 matrix;
uniform highp vec2 textureScale;
+uniform highp float dpr;
attribute highp vec4 vCoord;
attribute highp vec2 tCoord;
@@ -9,5 +10,5 @@ varying highp vec2 sampleCoord;
void main()
{
sampleCoord = tCoord * textureScale;
- gl_Position = matrix * floor(vCoord + 0.5);
+ gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr;
}
diff --git a/src/quick/scenegraph/shaders/textmask_core.vert b/src/quick/scenegraph/shaders/textmask_core.vert
index d145d33195..f996040f70 100644
--- a/src/quick/scenegraph/shaders/textmask_core.vert
+++ b/src/quick/scenegraph/shaders/textmask_core.vert
@@ -7,9 +7,10 @@ out vec2 sampleCoord;
uniform mat4 matrix;
uniform vec2 textureScale;
+uniform float dpr;
void main()
{
sampleCoord = tCoord * textureScale;
- gl_Position = matrix * round(vCoord);
+ gl_Position = matrix * round(vCoord * dpr) / dpr;
}