From b1a912a8a6ff472a49b2e0a09cfd433adfc2cb24 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 18 May 2024 21:53:38 -0400 Subject: reorganization, cross compiler --- kernel/framebuffer.cpp | 65 -------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 kernel/framebuffer.cpp (limited to 'kernel/framebuffer.cpp') diff --git a/kernel/framebuffer.cpp b/kernel/framebuffer.cpp deleted file mode 100644 index 08d0e16..0000000 --- a/kernel/framebuffer.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include - -namespace hilbert::kernel::framebuffer { - - uint64_t paddr; - static uint32_t *vaddr; - int width; - int height; - int dword_pitch; - - void init_framebuffer(uint64_t paddr, uint64_t vaddr, - uint64_t width, uint64_t height, uint64_t pitch - ) { - - //TODO: assumes 32-bpp rgb - - framebuffer::paddr = paddr; - framebuffer::vaddr = (uint32_t *)vaddr; - framebuffer::width = width; - framebuffer::height = height; - dword_pitch = pitch / 4; - - } - - color encode_color(uint8_t r, uint8_t g, uint8_t b) { - return ((uint32_t)r << 16) | ((uint32_t)g << 8) | (uint32_t)b; - } - - void set_pixel(int x, int y, color c) { - vaddr[y * dword_pitch + x] = c; - } - - void move_region( - int from_start_x, int from_start_y, int from_end_x, - int from_end_y, int to_start_x, int to_start_y - ) { - - int region_width = from_end_x - from_start_x; - int region_height = from_end_y - from_start_y; - - int from_start_offset = from_start_y * dword_pitch + from_start_x; - int to_start_offset = to_start_y * dword_pitch + to_start_x; - - if (from_start_offset > to_start_offset) - for (int y = 0; y < region_height; ++y) - for (int x = 0; x < region_width; ++x) - vaddr[to_start_offset + y * dword_pitch + x] = - vaddr[from_start_offset + y * dword_pitch + x]; - - else if (from_start_offset < to_start_offset) - for (int y = region_height - 1; y >= 0; --y) - for (int x = region_width - 1; x >= 0; --x) - vaddr[to_start_offset + y * dword_pitch + x] = - vaddr[from_start_offset + y * dword_pitch + x]; - - } - - void fill_region(int start_x, int start_y, int end_x, int end_y, color c) { - for (int y = start_y; y < end_y; ++y) - for (int x = start_x; x < end_x; ++x) - vaddr[y * dword_pitch + x] = c; - } - -} -- cgit v1.2.3