mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-13 04:27:47 -05:00
render: track alpha directly, rather whether to use it or not
This commit is contained in:
parent
22651ed221
commit
fcc2e62a7d
1 changed files with 5 additions and 6 deletions
11
render.c
11
render.c
|
|
@ -458,7 +458,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
uint32_t _fg = 0;
|
||||
uint32_t _bg = 0;
|
||||
|
||||
bool apply_alpha = false;
|
||||
uint16_t alpha = 0xffff;
|
||||
|
||||
if (is_selected && term->colors.use_custom_selection) {
|
||||
_fg = term->colors.selection_fg;
|
||||
|
|
@ -472,14 +472,14 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
uint32_t swap = _fg;
|
||||
_fg = _bg;
|
||||
_bg = swap;
|
||||
} else
|
||||
apply_alpha = !cell->attrs.have_bg;
|
||||
} else if (!cell->attrs.have_bg)
|
||||
alpha = term->colors.alpha;
|
||||
}
|
||||
|
||||
if (unlikely(is_selected && _fg == _bg)) {
|
||||
/* Invert bg when selected/highlighted text has same fg/bg */
|
||||
_bg = ~_bg;
|
||||
apply_alpha = false;
|
||||
alpha = 0xffff;
|
||||
}
|
||||
|
||||
if (cell->attrs.dim)
|
||||
|
|
@ -491,8 +491,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
_fg = color_dim(_fg);
|
||||
|
||||
pixman_color_t fg = color_hex_to_pixman(_fg);
|
||||
pixman_color_t bg = color_hex_to_pixman_with_alpha(
|
||||
_bg, apply_alpha ? term->colors.alpha : 0xffff);
|
||||
pixman_color_t bg = color_hex_to_pixman_with_alpha(_bg, alpha);
|
||||
|
||||
if (term->is_searching && !is_selected) {
|
||||
color_dim_for_search(&fg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue