aboutsummaryrefslogtreecommitdiff
path: root/box-drawing.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-05 14:34:57 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-05-17 15:58:29 +0000
commitd495da03e1d87f25e88a0d9edc8c39ba2b74e411 (patch)
tree9d36376714cfb674c6768638844a5b17d54013f7 /box-drawing.c
parentbox-drawing: swap amount of shade for LIGHT and DARK shades (diff)
box-drawing: temporary “fix” for LIGHT ARCs with a8 buffers
We don’t have a method to draw the arcs using pixman yet. Work around this by replacing the a8 buffer with an a1 buffer, and render the arcs using our old, non-antialiased, way.
Diffstat (limited to 'box-drawing.c')
-rw-r--r--box-drawing.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/box-drawing.c b/box-drawing.c
index ff1ccf22..188aafc0 100644
--- a/box-drawing.c
+++ b/box-drawing.c
@@ -1225,6 +1225,27 @@ draw_box_drawings_double_vertical_and_horizontal(struct buf *buf)
static void
draw_box_drawings_light_arc(wchar_t wc, struct buf *buf)
{
+ if (pixman_image_get_format(buf->pix) == PIXMAN_a8) {
+ /*
+ * Hack until we’ve implemented ARCs with pixman
+ *
+ * Replace the a8 buffer with a a1 buffer, and use our “old”
+ * non-antialiased technique to draw arcs.
+ */
+
+ int stride = stride_for_format_and_width(PIXMAN_a1, buf->width);
+ uint8_t *new_data = xcalloc(buf->height * stride, 1);
+ pixman_image_t *new_pix = pixman_image_create_bits_no_clear(
+ PIXMAN_a1, buf->width, buf->height, (uint32_t *)new_data, stride);
+
+ pixman_image_unref(buf->pix);
+ free(buf->data);
+
+ buf->data = new_data;
+ buf->pix = new_pix;
+ buf->stride = stride;
+ }
+
int thick = thickness(LIGHT);
double a = (buf->width - thick) / 2;
@@ -2359,7 +2380,7 @@ box_drawing(const struct terminal *term, wchar_t wc)
*glyph = (struct fcft_glyph){
.wc = wc,
.cols = 1,
- .pix = pix,
+ .pix = buf.pix,
.x = -term->font_x_ofs,
.y = term->font_y_ofs + term->fonts[0]->ascent,
.width = width,