1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

wezterm: avoid "shadow" AA artifacts when fg and bg are the same

When subpixel or greyscale AA are in use, the glyph data includes
some lighter and darker shaded pixels.  That's their purpose,
but if the fg and bg color are the same, the expectation is that
the glyph is invisible and we don't want "phantom" pixels around
the character.

This commit adjusts the shader to set the color to transparent
when the fg and bg are the same, and we are not rendering a color
emoji.

refs: #331
This commit is contained in:
Wez Furlong 2020-11-20 08:49:12 -08:00
parent 9d2df980e7
commit 8c858ae6ce

View File

@ -112,10 +112,18 @@ void main() {
if (o_has_color == 0.0) {
// if it's not a color emoji it will be grayscale
// and we need to tint with the fg_color
if (o_fg_color == o_bg_color) {
// However, if we're a monochrome glyph and the forground and
// background colors are the same, just render a transparent pixel
// instead; this avoids generating shadowy anti-aliasing artifacts
// for something that should otherwise be invisible.
color = vec4(0.0, 0.0, 0.0, 0.0);
} else {
color = multiply(o_fg_color, color);
}
}
}
}
color = apply_hsv(color);
}