aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-07-15 16:23:49 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-07-15 16:23:49 +0000
commitfcc2e62a7d9a38ab5818815e1f7c52267653f096 (patch)
treec539986addcfe35d74e4cf1743b63e08dba9dbd1
parentshm: reset buffer pool FD when we close it (diff)
render: track alpha directly, rather whether to use it or not
-rw-r--r--render.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/render.c b/render.c
index c50988fd..7dcad297 100644
--- a/render.c
+++ b/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);