Fast and reasonably complete (framebuffer) terminal emulator (Zig fork)

Terminal optimization option added : flanterm_toggle_masking() (#9)

* Terminal optimization option added : flanterm_toggle_masking()

* Terminal optimization option added

* error correction

---------

Co-authored-by: ernestbedight <bob@bedight.localdomain>

Bedight f946bd77 845df221

Changed files
+10 -5
backends
+10 -5
backends/fb.c
···
}
}
-
static void plot_char_fast(struct flanterm_context *_ctx, struct flanterm_fb_char *old, struct flanterm_fb_char *c, size_t x, size_t y) {
struct flanterm_fb_context *ctx = (void *)_ctx;
if (x >= _ctx->cols || y >= _ctx->rows) {
···
continue;
}
struct flanterm_fb_char *old = &ctx->grid[offset];
-
if (q->c.bg == old->bg && q->c.fg == old->fg) {
-
plot_char_fast(_ctx, old, &q->c, q->x, q->y);
-
} else {
plot_char(_ctx, &q->c, q->x, q->y);
-
}
ctx->grid[offset] = q->c;
ctx->map[offset] = NULL;
}
···
}
}
+
static void plot_char_masked(struct flanterm_context *_ctx, struct flanterm_fb_char *old, struct flanterm_fb_char *c, size_t x, size_t y) {
struct flanterm_fb_context *ctx = (void *)_ctx;
if (x >= _ctx->cols || y >= _ctx->rows) {
···
continue;
}
struct flanterm_fb_char *old = &ctx->grid[offset];
+
#ifdef FLANTERM_FB_ENABLE_MASKING
+
if (q->c.bg == old->bg && q->c.fg == old->fg) {
+
plot_char_masked(_ctx, old, &q->c, q->x, q->y);
+
} else {
+
plot_char(_ctx, &q->c, q->x, q->y);
+
}
+
#else
plot_char(_ctx, &q->c, q->x, q->y);
+
#endif
+
ctx->grid[offset] = q->c;
ctx->map[offset] = NULL;
}