Use actual color value comparison when detecting default background color

This is very slightly more GPU intensive but means that even if
an application explicitly sets the color to be the same as the default
color, it will be transparent.
This commit is contained in:
Kovid Goyal 2020-01-12 18:14:03 +05:30
parent d8ed135b46
commit 2045055ae3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -162,7 +162,8 @@ void main() {
float cell_has_cursor = is_cursor(c, r);
float is_block_cursor = step(float(cursor_fg_sprite_idx), 0.5);
float cell_has_block_cursor = cell_has_cursor * is_block_cursor;
vec3 bg = color_to_vec(resolve_color(colors[bg_index], default_colors[bg_index]));
uint bg_as_uint = resolve_color(colors[bg_index], default_colors[bg_index]);
vec3 bg = color_to_vec(bg_as_uint);
// }}}
// Foreground {{{
@ -200,7 +201,7 @@ void main() {
// Background {{{
#ifdef NEEDS_BACKROUND
float cell_has_non_default_bg = step(ONE, colors[bg_index] & BYTE_MASK);
float cell_has_non_default_bg = step(ONE, abs(bg_as_uint - default_colors[bg_index]));
#if defined(BACKGROUND)
background = bg;