From 2045055ae37eddf05aaa4c200c5552023d07cb8d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 Jan 2020 18:14:03 +0530 Subject: [PATCH] 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. --- kitty/cell_vertex.glsl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kitty/cell_vertex.glsl b/kitty/cell_vertex.glsl index 325d8d453..a9e5729b8 100644 --- a/kitty/cell_vertex.glsl +++ b/kitty/cell_vertex.glsl @@ -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;