From 8d09ba5bd2f8843232d25fc93acfcccd3513f1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 5 May 2021 14:59:53 +0200 Subject: [PATCH] =?UTF-8?q?box-drawing:=20include=20pixman=20image=20in=20?= =?UTF-8?q?the=20buffer=20we=E2=80=99re=20passing=20around?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box-drawing.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/box-drawing.c b/box-drawing.c index 5701bf46..2e387582 100644 --- a/box-drawing.c +++ b/box-drawing.c @@ -20,6 +20,7 @@ enum thickness { struct buf { uint8_t *data; + pixman_image_t *pix; int width; int height; int stride; @@ -2278,11 +2279,13 @@ box_drawing(const struct terminal *term, wchar_t wc) { int width = term->cell_width; int height = term->cell_height; - int stride = stride_for_format_and_width(PIXMAN_a1, width); + pixman_format_code_t fmt = PIXMAN_a1; /* TODO: use a8 when antialiasing=true */ + + int stride = stride_for_format_and_width(fmt, width); uint8_t *data = xcalloc(height * stride, 1); pixman_image_t *pix = pixman_image_create_bits_no_clear( - PIXMAN_a1, width, height, (uint32_t*)data, stride); + fmt, width, height, (uint32_t*)data, stride); if (pix == NULL) { errno = ENOMEM; @@ -2292,6 +2295,7 @@ box_drawing(const struct terminal *term, wchar_t wc) struct buf buf = { .data = data, + .pix = pix, .width = width, .height = height, .stride = stride,