diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-15 16:10:22 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-15 16:11:38 +0100 |
commit | 2298d17186cb0e58a96d285384de431902da9b1e (patch) | |
tree | 635d642931d9f55e701639ee3b3707e0e28a805e /stage3/gfx.c | |
parent | 8a25a2935a60e65fcb3e2b715bada858f5fcd6a2 (diff) | |
download | cuddles-2298d17186cb0e58a96d285384de431902da9b1e.tar.xz |
big chungus
* fix a heap corruption bug
* add qemu support
* add an ATA driver
* add an USTAR read-only file system
* boot from disk instead of floppy
* font rendering
* image rendering
* PCI enumeration
* init script
Diffstat (limited to 'stage3/gfx.c')
-rw-r--r-- | stage3/gfx.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/stage3/gfx.c b/stage3/gfx.c index 2afc766..79c76a3 100644 --- a/stage3/gfx.c +++ b/stage3/gfx.c @@ -1,4 +1,5 @@ #include "gfx.h" +#include "memory.h" struct GfxInfo *gfx_info = (void *) (0x1000-10); @@ -6,10 +7,10 @@ struct GfxInfo *gfx_info = (void *) (0x1000-10); u32 make_color(color col) { return ((u32) 0) - & ((u32) col.r << 0) - & ((u32) col.g << 8) - & ((u32) col.b << 16) - & ((u32) col.a << 24); + | ((u32) col.b << 0) + | ((u32) col.g << 8) + | ((u32) col.r << 16) + | ((u32) col.a << 24); } void gfx_set_pixel(u16 x, u16 y, u32 col) @@ -30,3 +31,10 @@ void gfx_set_area(u16 x, u16 y, u16 w, u16 h, u32 col) *((u32 *) rbeg) = col; } } + +void gfx_draw_img(u16 x, u16 y, u16 w, u16 h, color *img) +{ + void *cbeg = (void *) (u64) (gfx_info->framebuffer + y * gfx_info->pitch + x * sizeof(color)); + for (u16 yi = 0; yi < h; cbeg += gfx_info->pitch, yi++) + memcpy(cbeg, img + yi * w, w * sizeof(color)); +} |