Skip to content

Commit 0116068

Browse files
was using the wrong version
1 parent e0e27d1 commit 0116068

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

os/programs/fizzbuzz.rrbasic

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ END
1111

1212
DEF PROCfizzbuzz(n)
1313

14-
IF (n MOD 15) = 0 THEN
14+
IF n % 15 = 0 THEN
1515
PRINT "FizzBuzz"
1616
ELSE
17-
IF (n MOD 3) = 0 THEN
17+
IF n % 3 = 0 THEN
1818
PRINT "Fizz"
1919
ELSE
20-
IF (n MOD 5) = 0 THEN
20+
IF n % 5 = 0 THEN
2121
PRINT "Buzz"
2222
ELSE
2323
PRINT n

src/flanterm/fb.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,26 @@ static void plot_char_unscaled_canvas(struct flanterm_context *_ctx, struct flan
8787
return;
8888
}
8989

90+
uint32_t default_bg = ctx->default_bg;
91+
92+
uint32_t bg = c->bg == 0xffffffff ? default_bg : c->bg;
93+
uint32_t fg = c->fg == 0xffffffff ? default_bg : c->fg;
94+
9095
x = ctx->offset_x + x * ctx->glyph_width;
9196
y = ctx->offset_y + y * ctx->glyph_height;
9297

9398
bool *glyph = &ctx->font_bool[c->c * ctx->font_height * ctx->font_width];
9499
// naming: fx,fy for font coordinates, gx,gy for glyph coordinates
100+
if (ft_min_y == -1 || ft_min_y > (int64_t) y) {
101+
ft_min_y = (int64_t) y;
102+
}
103+
if (ft_max_y == -1 || ft_max_y < (int64_t) (y + ctx->glyph_height)) {
104+
ft_max_y = (int64_t) (y + ctx->glyph_height);
105+
}
95106
for (size_t gy = 0; gy < ctx->glyph_height; gy++) {
96107
volatile uint32_t *fb_line = ctx->framebuffer + x + (y + gy) * (ctx->pitch / 4);
97-
uint32_t *canvas_line = ctx->canvas + x + (y + gy) * ctx->width;
98108
bool *glyph_pointer = glyph + (gy * ctx->font_width);
99109
for (size_t fx = 0; fx < ctx->font_width; fx++) {
100-
uint32_t bg = c->bg == 0xffffffff ? canvas_line[fx] : c->bg;
101-
uint32_t fg = c->fg == 0xffffffff ? canvas_line[fx] : c->fg;
102110
fb_line[fx] = *(glyph_pointer++) ? fg : bg;
103111
}
104112
}
@@ -421,7 +429,6 @@ static void flanterm_fb_full_refresh(struct flanterm_context *_ctx) {
421429
for (size_t i = 0; i < (size_t) _ctx->rows * _ctx->cols; i++) {
422430
size_t x = i % _ctx->cols;
423431
size_t y = i / _ctx->cols;
424-
425432
ctx->plot_char(_ctx, &ctx->grid[i], x, y);
426433
}
427434

0 commit comments

Comments
 (0)