diff options
Diffstat (limited to 'drivers/gfx.c')
| -rw-r--r-- | drivers/gfx.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/gfx.c b/drivers/gfx.c index bcc103a..53d6686 100644 --- a/drivers/gfx.c +++ b/drivers/gfx.c @@ -15,10 +15,14 @@ static uint16_t fb_height; /* this is BYTES per pixel */ static uint8_t fb_bpp; +const uint8_t *gfx_bpp = &fb_bpp; const uint16_t *gfx_width = &fb_width; const uint16_t *gfx_height = &fb_height; +static int cursor_x, cursor_y; +static uint32_t fgcol, bgcol; + void gfx_drawpixel(int x, int y, uint32_t col) { ((uint32_t*)framebuffer)[y * fb_width + x] = col; @@ -35,6 +39,15 @@ void gfx_clear(uint32_t col) } } +void gfx_reset(void) +{ + gfx_clear(VGA_RGBPACK(0, 0, 0)); + cursor_y = 0; + cursor_x = 0; + fgcol = VGA_RGBPACK(0xff, 0xff, 0xff); + bgcol = VGA_RGBPACK(0, 0, 0); +} + void gfx_drawchar(int x, int y, char c, uint32_t fg, uint32_t bg) { int stride = fb_bpp * fb_width; @@ -53,9 +66,6 @@ void gfx_drawchar(int x, int y, char c, uint32_t fg, uint32_t bg) } } -static int cursor_x, cursor_y; -static uint32_t fgcol, bgcol; - void gfx_putchar(char ch) { if(ch != '\n') @@ -104,11 +114,7 @@ bool gfx_init(struct vbe_info_t *vbe_mode_info) printf("WARNING: BPP != 32, falling back to text mode...\n"); return false; } - gfx_clear(VGA_RGBPACK(0, 0, 0)); - cursor_y = 0; - cursor_x = 0; - fgcol = VGA_RGBPACK(0xff, 0xff, 0xff); - bgcol = VGA_RGBPACK(0, 0, 0); + gfx_reset(); set_putchar(gfx_putchar); set_puts(gfx_puts); |