summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-11-24 23:57:43 +0400
committerGitHub <noreply@github.com>2023-11-24 23:57:43 +0400
commit54889fc4ff117f59efb392955a18b414fee570c7 (patch)
tree7735c38ce117aea965218402dfd3b323757b9649
parent3bb4fb78b4e433c6176fa4422134e38fecc9ede3 (diff)
downloadalacritty-54889fc4ff117f59efb392955a18b414fee570c7.tar.gz
alacritty-54889fc4ff117f59efb392955a18b414fee570c7.zip
Make AA stronger for undercurl
This improves undercurl rendering preserving its original thickness. This also makes it look not out-of place when places next to other lines.
-rw-r--r--alacritty/res/rect.f.glsl6
1 files changed, 5 insertions, 1 deletions
diff --git a/alacritty/res/rect.f.glsl b/alacritty/res/rect.f.glsl
index 65701da3..9951861f 100644
--- a/alacritty/res/rect.f.glsl
+++ b/alacritty/res/rect.f.glsl
@@ -45,7 +45,11 @@ color_t draw_undercurl(float_t x, float_t y) {
// cosine curve.
float_t alpha = 1.;
if (y > undercurlTop || y < undercurlBottom) {
- alpha = 1. - min(abs(undercurlTop - y), abs(undercurlBottom - y));
+ // Doing proper SDF is complicated for this shader, so just make AA
+ // stronger by 1/x^2, which renders preserving underline thickness and
+ // being bold enough.
+ float_t dst = min(abs(undercurlTop - y), abs(undercurlBottom - y));
+ alpha -= dst * dst;
}
// The result is an alpha mask on a rect, which leaves only curve opaque.