aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-02 23:08:08 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-02 23:08:08 +0000
commit5cc2f94668d2852bbc3de1056526a1b829a32f7f (patch)
treef58e4a29bbad296f265f36048a76090e49c44565 /render.c
parentrender: mark cell overflowed into as dirty (diff)
parentbox-drawing: drop ‘pragma GCC optimize(“Os”)’ (diff)
Merge branch 'box-drawing'
Closes #198
Diffstat (limited to 'render.c')
-rw-r--r--render.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/render.c b/render.c
index 2951c466..680dd278 100644
--- a/render.c
+++ b/render.c
@@ -16,6 +16,7 @@
#define LOG_MODULE "render"
#define LOG_ENABLE_DBG 0
#include "log.h"
+#include "box-drawing.h"
#include "config.h"
#include "grid.h"
#include "hsl.h"
@@ -449,7 +450,27 @@ render_cell(struct terminal *term, pixman_image_t *pix,
base = composed->base;
}
- glyph = fcft_glyph_rasterize(font, base, term->font_subpixel);
+ if (unlikely((base >= 0x2500 && base <= 0x259f) ||
+ (base >= 0x1fb00 && base <= 0x1fb3b))) {
+ /* Box drawing characters */
+ size_t idx = base >= 0x1fb00 ? base - 0x1fb00 + 160 : base - 0x2500;
+ assert(idx < ALEN(term->box_drawing));
+
+ if (likely(term->box_drawing[idx] != NULL))
+ glyph = term->box_drawing[idx];
+ else {
+ mtx_lock(&term->render.workers.lock);
+
+ /* Parallel thread may have instantiated it while we took the lock */
+ if (term->box_drawing[idx] == NULL)
+ term->box_drawing[idx] = box_drawing(term, base);
+ mtx_unlock(&term->render.workers.lock);
+
+ glyph = term->box_drawing[idx];
+ assert(glyph != NULL);
+ }
+ } else
+ glyph = fcft_glyph_rasterize(font, base, term->font_subpixel);
}
const int cols_left = term->cols - col;