aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-08-04 10:59:27 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-08-05 07:45:36 +0200
commit4da53ed1d6433730d0604b948ba3b5abeabd1eb0 (patch)
tree57ff0dab9b5ae0e2451539dbd68090ab41676ddc /src/quick/scenegraph
parent28005c0c037626d5601192e2a412633656d52b39 (diff)
Fix regression in antialiasing on outlined text
After e8d9bc1bcada7d94af5a33d64a9afc860ede5b84, outline text would blend with the background rather than the fill color on the inner side of the outline. We should do the mix with the fill color like before this change, but for performance, we should still discard all pixels which are not part of the outline, which we do using step() instead of multiplying by 1.0 - a. Pick-to: 5.15 Task-number: QTBUG-85514 Change-Id: I4b252bdbd9dae5ee599ba7c5d1cc3609fef61622 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag3
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsbbin2088 -> 2172 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag3
-rw-r--r--src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsbbin2090 -> 2170 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext.frag2
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsbbin2251 -> 2392 bytes
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext_a.frag2
-rw-r--r--src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsbbin1359 -> 1437 bytes
8 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag
index 945ef56fee..b1551d8ef4 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag
+++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag
@@ -21,5 +21,6 @@ void main()
{
float d = texture(_qt_texture, sampleCoord).r;
float a = smoothstep(ubuf.alphaMin, ubuf.alphaMax, d);
- fragColor = (1.0 - a) * ubuf.styleColor * smoothstep(ubuf.outlineAlphaMax0, ubuf.outlineAlphaMax1, d);
+ fragColor = step(1.0 - a, 1.0) * mix(ubuf.styleColor, ubuf.color, a)
+ * smoothstep(ubuf.outlineAlphaMax0, ubuf.outlineAlphaMax1, d);
}
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb
index 51e552d912..d113427ba0 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag
index 7ccd06610a..7c6bd9a493 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag
+++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag
@@ -21,5 +21,6 @@ void main()
{
float d = texture(_qt_texture, sampleCoord).a;
float a = smoothstep(ubuf.alphaMin, ubuf.alphaMax, d);
- fragColor = (1.0 - a) * ubuf.styleColor * smoothstep(ubuf.outlineAlphaMax0, ubuf.outlineAlphaMax1, d);
+ fragColor = step(1.0 - a, 1.0) * mix(ubuf.styleColor, ubuf.color, a)
+ * smoothstep(ubuf.outlineAlphaMax0, ubuf.outlineAlphaMax1, d);
}
diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb
index 909decb63e..c956769849 100644
--- a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.frag b/src/quick/scenegraph/shaders_ng/outlinedtext.frag
index aac9e4bff8..947d161a50 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext.frag
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext.frag
@@ -29,5 +29,5 @@ void main()
texture(_qt_texture, sCoordRight).r,
0.0, 1.0) - glyph,
0.0, 1.0);
- fragColor = outline * ubuf.styleColor;
+ fragColor = outline * ubuf.styleColor + step(1.0 - glyph, 1.0) * glyph * ubuf.color;
}
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
index ba93aea685..883903d20c 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb
Binary files differ
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag
index 481d8c94d0..5b7bd9ca82 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag
@@ -29,5 +29,5 @@ void main()
texture(_qt_texture, sCoordRight).a,
0.0, 1.0) - glyph,
0.0, 1.0);
- fragColor = outline * ubuf.styleColor;
+ fragColor = outline * ubuf.styleColor + step(1.0 - glyph, 1.0) * glyph * ubuf.color;
}
diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
index 11f5f0046d..f44b92dc28 100644
--- a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
+++ b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb
Binary files differ