aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/shaders/loqsubpixeldistancefieldtext.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/shaders/loqsubpixeldistancefieldtext.frag')
-rw-r--r--src/quick/scenegraph/shaders/loqsubpixeldistancefieldtext.frag17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/quick/scenegraph/shaders/loqsubpixeldistancefieldtext.frag b/src/quick/scenegraph/shaders/loqsubpixeldistancefieldtext.frag
new file mode 100644
index 0000000000..61b6c8dd9a
--- /dev/null
+++ b/src/quick/scenegraph/shaders/loqsubpixeldistancefieldtext.frag
@@ -0,0 +1,17 @@
+varying highp vec3 sampleNearLeft;
+varying highp vec3 sampleNearRight;
+
+uniform sampler2D _qt_texture;
+uniform lowp vec4 color;
+uniform mediump float alphaMin;
+uniform mediump float alphaMax;
+
+void main()
+{
+ highp vec2 n;
+ n.x = texture2DProj(_qt_texture, sampleNearLeft).a;
+ n.y = texture2DProj(_qt_texture, sampleNearRight).a;
+ n = smoothstep(alphaMin, alphaMax, n);
+ highp float c = 0.5 * (n.x + n.y);
+ gl_FragColor = vec4(n.x, c, n.y, c) * color.w;
+} \ No newline at end of file