mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-02 07:15:31 -04: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 _fg = 0;
|
||||||
uint32_t _bg = 0;
|
uint32_t _bg = 0;
|
||||||
|
|
||||||
bool apply_alpha = false;
|
uint16_t alpha = 0xffff;
|
||||||
|
|
||||||
if (is_selected && term->colors.use_custom_selection) {
|
if (is_selected && term->colors.use_custom_selection) {
|
||||||
_fg = term->colors.selection_fg;
|
_fg = term->colors.selection_fg;
|
||||||
|
|
@ -472,14 +472,14 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
uint32_t swap = _fg;
|
uint32_t swap = _fg;
|
||||||
_fg = _bg;
|
_fg = _bg;
|
||||||
_bg = swap;
|
_bg = swap;
|
||||||
} else
|
} else if (!cell->attrs.have_bg)
|
||||||
apply_alpha = !cell->attrs.have_bg;
|
alpha = term->colors.alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(is_selected && _fg == _bg)) {
|
if (unlikely(is_selected && _fg == _bg)) {
|
||||||
/* Invert bg when selected/highlighted text has same fg/bg */
|
/* Invert bg when selected/highlighted text has same fg/bg */
|
||||||
_bg = ~_bg;
|
_bg = ~_bg;
|
||||||
apply_alpha = false;
|
alpha = 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cell->attrs.dim)
|
if (cell->attrs.dim)
|
||||||
|
|
@ -491,8 +491,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
_fg = color_dim(_fg);
|
_fg = color_dim(_fg);
|
||||||
|
|
||||||
pixman_color_t fg = color_hex_to_pixman(_fg);
|
pixman_color_t fg = color_hex_to_pixman(_fg);
|
||||||
pixman_color_t bg = color_hex_to_pixman_with_alpha(
|
pixman_color_t bg = color_hex_to_pixman_with_alpha(_bg, alpha);
|
||||||
_bg, apply_alpha ? term->colors.alpha : 0xffff);
|
|
||||||
|
|
||||||
if (term->is_searching && !is_selected) {
|
if (term->is_searching && !is_selected) {
|
||||||
color_dim_for_search(&fg);
|
color_dim_for_search(&fg);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue