aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-04 08:46:33 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-05-04 08:46:33 +0000
commit3595d95c2785de5148749101eb16b9c62df6ac22 (patch)
treed5246a0ae07c36c13d4520c392b62effc3215983 /render.c
parentMerge branch 'missing-xkb-build-dependency' (diff)
parentrender: only apply alpha when we’re using the default bg for background (diff)
Merge branch 'bg-alpha-on-default-bg-only'
Diffstat (limited to 'render.c')
-rw-r--r--render.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/render.c b/render.c
index e4387c08..7d5dc8d7 100644
--- a/render.c
+++ b/render.c
@@ -429,6 +429,8 @@ render_cell(struct terminal *term, pixman_image_t *pix,
uint32_t _fg = 0;
uint32_t _bg = 0;
+ bool apply_alpha = false;
+
if (is_selected && term->colors.use_custom_selection) {
_fg = term->colors.selection_fg;
_bg = term->colors.selection_bg;
@@ -441,12 +443,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;
}
if (unlikely(is_selected && _fg == _bg)) {
/* Invert bg when selected/highlighted text has same fg/bg */
_bg = ~_bg;
+ apply_alpha = false;
}
if (cell->attrs.dim)
@@ -459,9 +463,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
pixman_color_t fg = color_hex_to_pixman(_fg);
pixman_color_t bg = color_hex_to_pixman_with_alpha(
- _bg,
- (_bg == (term->reverse ? term->colors.fg : term->colors.bg)
- ? term->colors.alpha : 0xffff));
+ _bg, apply_alpha ? term->colors.alpha : 0xffff);
if (term->is_searching && !is_selected) {
color_dim_for_search(&fg);