diff options
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)); +} |