Skip to content

Commit 6b943d3

Browse files
remove unused plot char variants
1 parent 43a352a commit 6b943d3

1 file changed

Lines changed: 1 addition & 106 deletions

File tree

src/flanterm/fb.c

Lines changed: 1 addition & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -80,66 +80,6 @@ static void flanterm_fb_swap_palette(struct flanterm_context *_ctx) {
8080
ctx->text_fg = tmp;
8181
}
8282

83-
static void plot_char_scaled_canvas(struct flanterm_context *_ctx, struct flanterm_fb_char *c, size_t x, size_t y) {
84-
struct flanterm_fb_context *ctx = (void *) _ctx;
85-
86-
if (x >= _ctx->cols || y >= _ctx->rows) {
87-
return;
88-
}
89-
90-
x = ctx->offset_x + x * ctx->glyph_width;
91-
y = ctx->offset_y + y * ctx->glyph_height;
92-
93-
bool *glyph = &ctx->font_bool[c->c * ctx->font_height * ctx->font_width];
94-
// naming: fx,fy for font coordinates, gx,gy for glyph coordinates
95-
for (size_t gy = 0; gy < ctx->glyph_height; gy++) {
96-
uint8_t fy = gy / ctx->font_scale_y;
97-
volatile uint32_t *fb_line = ctx->framebuffer + x + (y + gy) * (ctx->pitch / 4);
98-
uint32_t *canvas_line = ctx->canvas + x + (y + gy) * ctx->width;
99-
bool *glyph_pointer = glyph + (fy * ctx->font_width);
100-
for (size_t fx = 0; fx < ctx->font_width; fx++) {
101-
for (size_t i = 0; i < ctx->font_scale_x; i++) {
102-
size_t gx = ctx->font_scale_x * fx + i;
103-
uint32_t bg = c->bg == 0xffffffff ? canvas_line[gx] : c->bg;
104-
uint32_t fg = c->fg == 0xffffffff ? canvas_line[gx] : c->fg;
105-
fb_line[gx] = *glyph_pointer ? fg : bg;
106-
}
107-
glyph_pointer++;
108-
}
109-
}
110-
}
111-
112-
static void plot_char_scaled_uncanvas(struct flanterm_context *_ctx, struct flanterm_fb_char *c, size_t x, size_t y) {
113-
struct flanterm_fb_context *ctx = (void *) _ctx;
114-
115-
if (x >= _ctx->cols || y >= _ctx->rows) {
116-
return;
117-
}
118-
119-
uint32_t default_bg = ctx->default_bg;
120-
121-
uint32_t bg = c->bg == 0xffffffff ? default_bg : c->bg;
122-
uint32_t fg = c->fg == 0xffffffff ? default_bg : c->fg;
123-
124-
x = ctx->offset_x + x * ctx->glyph_width;
125-
y = ctx->offset_y + y * ctx->glyph_height;
126-
127-
bool *glyph = &ctx->font_bool[c->c * ctx->font_height * ctx->font_width];
128-
// naming: fx,fy for font coordinates, gx,gy for glyph coordinates
129-
for (size_t gy = 0; gy < ctx->glyph_height; gy++) {
130-
uint8_t fy = gy / ctx->font_scale_y;
131-
volatile uint32_t *fb_line = ctx->framebuffer + x + (y + gy) * (ctx->pitch / 4);
132-
bool *glyph_pointer = glyph + (fy * ctx->font_width);
133-
for (size_t fx = 0; fx < ctx->font_width; fx++) {
134-
for (size_t i = 0; i < ctx->font_scale_x; i++) {
135-
size_t gx = ctx->font_scale_x * fx + i;
136-
fb_line[gx] = *glyph_pointer ? fg : bg;
137-
}
138-
glyph_pointer++;
139-
}
140-
}
141-
}
142-
14383
static void plot_char_unscaled_canvas(struct flanterm_context *_ctx, struct flanterm_fb_char *c, size_t x, size_t y) {
14484
struct flanterm_fb_context *ctx = (void *) _ctx;
14585

@@ -172,38 +112,6 @@ int64_t flanterm_ex_get_bounding_max_y() {
172112
return ft_max_y;
173113
}
174114

175-
static void plot_char_unscaled_uncanvas(struct flanterm_context *_ctx, struct flanterm_fb_char *c, size_t x, size_t y) {
176-
struct flanterm_fb_context *ctx = (void *) _ctx;
177-
178-
if (x >= _ctx->cols || y >= _ctx->rows) {
179-
return;
180-
}
181-
182-
uint32_t default_bg = ctx->default_bg;
183-
184-
uint32_t bg = c->bg == 0xffffffff ? default_bg : c->bg;
185-
uint32_t fg = c->fg == 0xffffffff ? default_bg : c->fg;
186-
187-
x = ctx->offset_x + x * ctx->glyph_width;
188-
y = ctx->offset_y + y * ctx->glyph_height;
189-
190-
bool *glyph = &ctx->font_bool[c->c * ctx->font_height * ctx->font_width];
191-
// naming: fx,fy for font coordinates, gx,gy for glyph coordinates
192-
if (ft_min_y == -1 || ft_min_y > (int64_t) y) {
193-
ft_min_y = (int64_t) y;
194-
}
195-
if (ft_max_y == -1 || ft_max_y < (int64_t) (y + ctx->glyph_height)) {
196-
ft_max_y = (int64_t) (y + ctx->glyph_height);
197-
}
198-
for (size_t gy = 0; gy < ctx->glyph_height; gy++) {
199-
volatile uint32_t *fb_line = ctx->framebuffer + x + (y + gy) * (ctx->pitch / 4);
200-
bool *glyph_pointer = glyph + (gy * ctx->font_width);
201-
for (size_t fx = 0; fx < ctx->font_width; fx++) {
202-
fb_line[fx] = *(glyph_pointer++) ? fg : bg;
203-
}
204-
}
205-
}
206-
207115
static inline bool compare_char(struct flanterm_fb_char *a, struct flanterm_fb_char *b) {
208116
return !(a->c != b->c || a->bg != b->bg || a->fg != b->fg);
209117
}
@@ -759,20 +667,7 @@ struct flanterm_context *flanterm_fb_init(
759667
}
760668
}
761669

762-
// if (font_scale_x == 1 && font_scale_y == 1) {
763-
// if (canvas == NULL) {
764-
// ctx->plot_char = plot_char_unscaled_uncanvas;
765-
// } else {
766-
ctx->plot_char = plot_char_unscaled_canvas;
767-
// }
768-
// } else {
769-
// if (canvas == NULL) {
770-
// ctx->plot_char = plot_char_scaled_uncanvas;
771-
// } else {
772-
// ctx->plot_char = plot_char_scaled_canvas;
773-
// }
774-
// }
775-
670+
ctx->plot_char = plot_char_unscaled_canvas;
776671
_ctx->raw_putchar = flanterm_fb_raw_putchar;
777672
_ctx->clear = flanterm_fb_clear;
778673
_ctx->set_cursor_pos = flanterm_fb_set_cursor_pos;

0 commit comments

Comments
 (0)