void fbterm_cursor_draw(struct fbterm_ctx *ctx, int row, int col) { struct font *font = ctx->font; for (int i = font->rows-1; i < font->rows; ++i) { int cx = col * font->cols; for (int j = 0; j < font->cols; ++j) { fb_put_pixel(ctx, cx, row*font->rows+i, -1, 0); ++cx; } } }
static void fbcon_drawglyph_tp(unsigned x, unsigned y, unsigned *glyph) { unsigned xd, yd, data; data = glyph[0]; for (yd = 0; yd < (FONT_HEIGHT / 2); ++yd) { for (xd = 0; xd < FONT_WIDTH; ++xd) { if (data & 1) { fb_put_pixel(x+xd, y+yd, FGCOLOR_R, FGCOLOR_G, FGCOLOR_B); } else { fb_put_pixel(x+xd, y+yd, BGCOLOR_R, BGCOLOR_G, BGCOLOR_B); } data >>= 1; } fb_put_pixel(x+FONT_WIDTH, y+yd, BGCOLOR_R, BGCOLOR_G, BGCOLOR_B); } data = glyph[1]; for (yd = 0; yd < (FONT_HEIGHT / 2); yd++) { for (xd = 0; xd < FONT_WIDTH; xd++) { if (data & 1) { fb_put_pixel(x+xd, y+yd+(FONT_HEIGHT/2), FGCOLOR_R, FGCOLOR_G, FGCOLOR_B); } else { fb_put_pixel(x+xd, y+yd+(FONT_HEIGHT/2), BGCOLOR_R, BGCOLOR_G, BGCOLOR_B); } data >>= 1; } fb_put_pixel(x+FONT_WIDTH, y+yd+(FONT_HEIGHT/2), BGCOLOR_R, BGCOLOR_G, BGCOLOR_B); } }
/* Term helpers */ static void fbterm_putc(struct fbterm_ctx *ctx, int row, int col, char c, uint32_t fg, uint32_t bg) { struct font *font = ctx->font; char fbuf[font->rows * font->cols]; font_bitmap(font, fbuf, c); for (int i = 0; i < font->rows; ++i) { int cx = col * font->cols; for (int j = 0; j < font->cols; ++j) { char v = fbuf[i * font->cols + j]; fb_put_pixel(ctx, cx, row*font->rows+i, _ALPHA(fg, v), bg); ++cx; } } }