Better variable name

This commit is contained in:
Kovid Goyal
2024-09-19 08:27:52 +05:30
parent 25e255e66f
commit 1a9abbcc7c

View File

@@ -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
@@ -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