···
if (x >= _ctx->cols || y >= _ctx->rows) {
412
+
#ifdef FLANTERM_FB_DISABLE_CANVAS
413
+
uint32_t default_bg = ctx->default_bg;
x = ctx->offset_x + x * ctx->glyph_width;
y = ctx->offset_y + y * ctx->glyph_height;
···
for (size_t gy = 0; gy < ctx->glyph_height; gy++) {
uint8_t fy = gy / ctx->font_scale_y;
volatile uint32_t *fb_line = ctx->framebuffer + x + (y + gy) * (ctx->pitch / 4);
425
+
#ifndef FLANTERM_FB_DISABLE_CANVAS
uint32_t *canvas_line = ctx->canvas + x + (y + gy) * ctx->width;
for (size_t fx = 0; fx < ctx->font_width; fx++) {
bool draw = glyph[fy * ctx->font_width + fx];
for (size_t i = 0; i < ctx->font_scale_x; i++) {
size_t gx = ctx->font_scale_x * fx + i;
433
+
#ifndef FLANTERM_FB_DISABLE_CANVAS
uint32_t bg = c->bg == 0xffffffff ? canvas_line[gx] : c->bg;
uint32_t fg = c->fg == 0xffffffff ? canvas_line[gx] : c->fg;
437
+
uint32_t bg = c->bg == 0xffffffff ? default_bg : c->bg;
438
+
uint32_t fg = c->fg == 0xffffffff ? default_bg : c->fg;
fb_line[gx] = draw ? fg : bg;
···
x = ctx->offset_x + x * ctx->glyph_width;
y = ctx->offset_y + y * ctx->glyph_height;
456
+
#ifdef FLANTERM_FB_DISABLE_CANVAS
457
+
uint32_t default_bg = ctx->default_bg;
bool *new_glyph = &ctx->font_bool[c->c * ctx->font_height * ctx->font_width];
bool *old_glyph = &ctx->font_bool[old->c * ctx->font_height * ctx->font_width];
···
for (size_t i = 0; i < ctx->font_scale_x; i++) {
size_t gx = ctx->font_scale_x * fx + i;
473
+
#ifndef FLANTERM_FB_DISABLE_CANVAS
uint32_t bg = c->bg == 0xffffffff ? canvas_line[gx] : c->bg;
uint32_t fg = c->fg == 0xffffffff ? canvas_line[gx] : c->fg;
477
+
uint32_t bg = c->bg == 0xffffffff ? default_bg : c->bg;
478
+
uint32_t fg = c->fg == 0xffffffff ? default_bg : c->fg;
fb_line[gx] = new_draw ? fg : bg;
···
static void flanterm_fb_full_refresh(struct flanterm_context *_ctx) {
struct flanterm_fb_context *ctx = (void *)_ctx;
779
+
#ifdef FLANTERM_FB_DISABLE_CANVAS
780
+
uint32_t default_bg = ctx->default_bg;
for (size_t y = 0; y < ctx->height; y++) {
for (size_t x = 0; x < ctx->width; x++) {
785
+
#ifndef FLANTERM_FB_DISABLE_CANVAS
ctx->framebuffer[y * (ctx->pitch / sizeof(uint32_t)) + x] = ctx->canvas[y * ctx->width + x];
788
+
ctx->framebuffer[y * (ctx->pitch / sizeof(uint32_t)) + x] = default_bg;
···
_free(ctx->grid, ctx->grid_size);
_free(ctx->queue, ctx->queue_size);
_free(ctx->map, ctx->map_size);
814
+
#ifndef FLANTERM_FB_DISABLE_CANVAS
_free(ctx->canvas, ctx->canvas_size);
_free(ctx, sizeof(struct flanterm_fb_context));
struct flanterm_context *flanterm_fb_init(
void *(*_malloc)(size_t),
uint32_t *framebuffer, size_t width, size_t height, size_t pitch,
824
+
#ifndef FLANTERM_FB_DISABLE_CANVAS
uint32_t *ansi_colours, uint32_t *ansi_bright_colours,
uint32_t *default_bg, uint32_t *default_fg,
uint32_t *default_bg_bright, uint32_t *default_fg_bright,
···
ctx->map = _malloc(ctx->map_size);
memset(ctx->map, 0, ctx->map_size);
980
+
#ifndef FLANTERM_FB_DISABLE_CANVAS
ctx->canvas_size = ctx->width * ctx->height * sizeof(uint32_t);
ctx->canvas = _malloc(ctx->canvas_size);
···
ctx->canvas[i] = ctx->default_bg;
_ctx->raw_putchar = flanterm_fb_raw_putchar;
_ctx->clear = flanterm_fb_clear;