diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-05-05 20:24:25 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-05-17 15:58:30 +0000 |
| commit | e7109d6b7739503c1d69749bda63460fb65580f0 (patch) | |
| tree | 41e5cfd1c0f6316e1fb3f1cad6dcdfef9855893b /box-drawing.c | |
| parent | box-drawing: use an a8 buffer when primary font is antialiased (diff) | |
config: add tweak.box-drawing-solid-shades=yes|no
When enabled, shades are rendered as solid blocks, using a darker
variant of the current foreground color.
When disabled, shades are instead rendered in a checker box pattern,
using the foreground color unmodified.
Default is enabled.
Diffstat (limited to 'box-drawing.c')
| -rw-r--r-- | box-drawing.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/box-drawing.c b/box-drawing.c index 39deab50..e9e7ec33 100644 --- a/box-drawing.c +++ b/box-drawing.c @@ -27,9 +27,9 @@ struct buf { int dpi; float cell_size; float base_thickness; + bool solid_shades; }; -static const bool solid_shades = true; /* TODO: configurable? */ static const pixman_color_t white = {0xffff, 0xffff, 0xffff, 0xffff}; static void @@ -1756,12 +1756,12 @@ draw_light_shade(struct buf *buf) { pixman_format_code_t fmt = pixman_image_get_format(buf->pix); - if (solid_shades && fmt == PIXMAN_a1) + if (buf->solid_shades && fmt == PIXMAN_a1) change_buffer_format(buf, PIXMAN_a8); - else if (!solid_shades && fmt == PIXMAN_a8) + else if (!buf->solid_shades && fmt == PIXMAN_a8) change_buffer_format(buf, PIXMAN_a1); - if (solid_shades) + if (buf->solid_shades) draw_pixman_shade(buf, 0x2000); else { for (size_t row = 0; row < buf->height; row += 2) { @@ -1779,12 +1779,12 @@ draw_medium_shade(struct buf *buf) { pixman_format_code_t fmt = pixman_image_get_format(buf->pix); - if (solid_shades && fmt == PIXMAN_a1) + if (buf->solid_shades && fmt == PIXMAN_a1) change_buffer_format(buf, PIXMAN_a8); - else if (!solid_shades && fmt == PIXMAN_a8) + else if (!buf->solid_shades && fmt == PIXMAN_a8) change_buffer_format(buf, PIXMAN_a1); - if (solid_shades) + if (buf->solid_shades) draw_pixman_shade(buf, 0x4000); else { for (size_t row = 0; row < buf->height; row++) { @@ -1802,12 +1802,12 @@ draw_dark_shade(struct buf *buf) { pixman_format_code_t fmt = pixman_image_get_format(buf->pix); - if (solid_shades && fmt == PIXMAN_a1) + if (buf->solid_shades && fmt == PIXMAN_a1) change_buffer_format(buf, PIXMAN_a8); - else if (!solid_shades && fmt == PIXMAN_a8) + else if (!buf->solid_shades && fmt == PIXMAN_a8) change_buffer_format(buf, PIXMAN_a1); - if (solid_shades) + if (buf->solid_shades) draw_pixman_shade(buf, 0x8000); else { for (size_t row = 0; row < buf->height; row++) { @@ -2440,6 +2440,7 @@ box_drawing(const struct terminal *term, wchar_t wc) .dpi = term->font_dpi, .cell_size = sqrt(pow(term->cell_width, 2) + pow(term->cell_height, 2)), .base_thickness = term->conf->tweak.box_drawing_base_thickness, + .solid_shades = term->conf->tweak.box_drawing_solid_shades, }; LOG_DBG("LIGHT=%d, HEAVY=%d", |
