summaryrefslogtreecommitdiff
path: root/stage3/gfx.c
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2024-04-11 20:58:38 +0200
committerLizzy Fleckenstein <lizzy@vlhl.dev>2024-04-11 21:05:47 +0200
commit8b90c1f407b4f4aa3802858e23aa90d7dfbe17ad (patch)
tree4080e975e33df6f3c57ff5f3486f97923c9bbbe3 /stage3/gfx.c
parenta6669e496e46ef89673103b3330226c7d0201a1a (diff)
downloadcuddles-8b90c1f407b4f4aa3802858e23aa90d7dfbe17ad.tar.xz
bootinfo struct
Diffstat (limited to 'stage3/gfx.c')
-rw-r--r--stage3/gfx.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/stage3/gfx.c b/stage3/gfx.c
index 7fe8df7..4c9fe4c 100644
--- a/stage3/gfx.c
+++ b/stage3/gfx.c
@@ -1,7 +1,6 @@
#include "gfx.h"
#include "memory.h"
-
-struct GfxInfo *gfx_info = (void *) (0x1000-10);
+#include "bootinfo.h"
// byteswap
u32 make_color(color col)
@@ -15,17 +14,17 @@ u32 make_color(color col)
void gfx_set_pixel(u16 x, u16 y, u32 col)
{
- u32 *out = (u32 *) (u64) (gfx_info->framebuffer + y * gfx_info->pitch + x * sizeof col);
+ u32 *out = bootinfo->gfx_framebuffer + y * bootinfo->gfx_pitch + x * sizeof col;
*out = col;
BARRIER_VAR(out);
}
void gfx_set_area(u16 x, u16 y, u16 w, u16 h, u32 col)
{
- void *cbeg = (void *) (u64) (gfx_info->framebuffer + y * gfx_info->pitch + x * sizeof col);
- void *cend = cbeg + h * gfx_info->pitch;
+ void *cbeg = bootinfo->gfx_framebuffer + y * bootinfo->gfx_pitch + x * sizeof col;
+ void *cend = cbeg + h * bootinfo->gfx_pitch;
- for (; cbeg < cend; cbeg += gfx_info->pitch) {
+ for (; cbeg < cend; cbeg += bootinfo->gfx_pitch) {
u32 *rbeg = cbeg;
u32 *rend = rbeg + w;
@@ -38,8 +37,8 @@ void gfx_set_area(u16 x, u16 y, u16 w, u16 h, u32 col)
void gfx_draw_img(u16 x, u16 y, u16 w, u16 h, u32 *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++)
+ void *cbeg = bootinfo->gfx_framebuffer + y * bootinfo->gfx_pitch + x * sizeof(color);
+ for (u16 yi = 0; yi < h; cbeg += bootinfo->gfx_pitch, yi++)
lmemcpy(cbeg, img + yi * w, w * sizeof(color));
BARRIER_VAR(cbeg);