From dca35215d079d11f0138a4cd2c98b76b39524a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 5 Dec 2020 11:59:41 +0100 Subject: [PATCH] render: search: render colorized glyphs (emojis) correctly --- render.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/render.c b/render.c index 24e4c6c4..565e8878 100644 --- a/render.c +++ b/render.c @@ -2184,12 +2184,20 @@ render_search_box(struct terminal *term) if (glyph == NULL) continue; - pixman_image_t *src = pixman_image_create_solid_fill(&fg); - pixman_image_composite32( - PIXMAN_OP_OVER, src, glyph->pix, buf->pix[0], 0, 0, 0, 0, - x + glyph->x, y + font_baseline(term) - glyph->y, + if (unlikely(pixman_image_get_format(glyph->pix) == PIXMAN_a8r8g8b8)) { + /* Glyph surface is a pre-rendered image (typically a color emoji...) */ + pixman_image_composite32( + PIXMAN_OP_OVER, glyph->pix, NULL, buf->pix[0], 0, 0, 0, 0, + x + glyph->x, y + font_baseline(term) - glyph->y, + glyph->width, glyph->height); + } else { + pixman_image_t *src = pixman_image_create_solid_fill(&fg); + pixman_image_composite32( + PIXMAN_OP_OVER, src, glyph->pix, buf->pix[0], 0, 0, 0, 0, + x + glyph->x, y + font_baseline(term) - glyph->y, glyph->width, glyph->height); - pixman_image_unref(src); + pixman_image_unref(src); + } x += term->cell_width; }