Skip to content

Commit

Permalink
Better variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Sep 19, 2024
1 parent 25e255e commit 1a9abbc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions kitty/cell_vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ void main() {
// }}}

// Background {{{
float cell_has_non_default_bg = step(1, float(abs(
float bg_is_not_transparent = step(1, float(abs(
(bg_as_uint - default_colors[1]) * (bg_as_uint - second_transparent_bg)
)));
))); // bg_is_not_transparent = 0 if bg_as_uint in (default_colors[1], second_transparent_bg) else 1
draw_bg = 1;

#if (PHASE == PHASE_BACKGROUND)
// draw_bg_bitfield has bit 0 set to draw default bg cells and bit 1 set to draw non-default bg cells
uint draw_bg_mask = uint(2 * cell_has_non_default_bg + (1 - cell_has_non_default_bg));
uint draw_bg_mask = uint(2 * bg_is_not_transparent + (1 - bg_is_not_transparent));
draw_bg = step(1, float(draw_bg_bitfield & draw_bg_mask));
#endif

Expand All @@ -213,12 +213,12 @@ void main() {
// selections/block cursor and 0 everywhere else.
float is_special_cell = cell_data.has_block_cursor + float(is_selected & ONE);
#if (PHASE != PHASE_SPECIAL)
is_special_cell += cell_has_non_default_bg + float(is_reversed);
is_special_cell += bg_is_not_transparent + float(is_reversed);
#endif
bg_alpha = step(0.5, is_special_cell);
bg_alpha = step(0.5, is_special_cell); // bg_alpha = 1 if is_special_cell else 0
#if (PHASE != PHASE_SPECIAL)
bg_alpha = bg_alpha + (1.0f - bg_alpha) * background_opacity;
bg_alpha *= draw_bg;
bg_alpha = bg_alpha + (1.0f - bg_alpha) * background_opacity; // bg_alpha = 1 if bg_alpha else background_opacity
bg_alpha *= draw_bg; // if not draw_bg: bg_alpha = 0
#endif
#endif

Expand Down

0 comments on commit 1a9abbc

Please sign in to comment.