diff options
author | Benji Dial <benji6283@gmail.com> | 2021-03-04 14:24:47 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-03-04 14:24:47 -0500 |
commit | 922470255bef5d09e2c12cc2b6597e629f3b2581 (patch) | |
tree | 78dd86f375e5313812f5bd4f9f82686b10d931d6 /src/kernel/window.c | |
parent | 2fc768319887945c5c6beafcd21d29d9884cd48a (diff) | |
download | portland-os-922470255bef5d09e2c12cc2b6597e629f3b2581.tar.gz |
no mouse on you may power off screen
Diffstat (limited to 'src/kernel/window.c')
-rw-r--r-- | src/kernel/window.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/kernel/window.c b/src/kernel/window.c index 28f7010..d50e454 100644 --- a/src/kernel/window.c +++ b/src/kernel/window.c @@ -170,8 +170,15 @@ static const bool power_off_message[] = { #define POWER_OFF_SCALE 3 void show_shutdown() { - for (uint32_t i = 0; i < VBE_MODE_INFO->height * VBE_MODE_INFO->width; ++i) - buffer[i].p = (struct pixel){.r = 0, .g = 0, .b = 0}; + void *row = VBE_MODE_INFO->frame_buf; + for (uint32_t y = 0; y < VBE_MODE_INFO->height; ++y) { + void *i = row; + for (uint32_t x = 0; x < VBE_MODE_INFO->width; ++x) { + blit_pixel(i, (struct pixel){.r = 0, .g = 0, .b = 0}); + i += (VBE_MODE_INFO->bpp / 8); + } + row += VBE_MODE_INFO->pitch; + } const uint16_t x_pad = (VBE_MODE_INFO->width - POWER_OFF_MESSAGE_PITCH * POWER_OFF_SCALE) / 2; const uint16_t y_pad = (VBE_MODE_INFO->height - POWER_OFF_MESSAGE_ROWS * POWER_OFF_SCALE) / 2; @@ -179,13 +186,16 @@ void show_shutdown() { for (uint8_t r = 0; r < POWER_OFF_MESSAGE_ROWS; ++r) for (uint8_t i = 0; i < POWER_OFF_MESSAGE_PITCH; ++i) if (power_off_message[r * POWER_OFF_MESSAGE_PITCH + i]) { - const uint32_t o = x_pad + i * POWER_OFF_SCALE + (y_pad + r * POWER_OFF_SCALE) * VBE_MODE_INFO->width; + void *const o = VBE_MODE_INFO->frame_buf + + (y_pad + r * POWER_OFF_SCALE) * VBE_MODE_INFO->pitch + + (x_pad + i * POWER_OFF_SCALE) * VBE_MODE_INFO->bpp / 8; for (uint8_t y = 0; y < POWER_OFF_SCALE; ++y) for (uint8_t x = 0; x < POWER_OFF_SCALE; ++x) - buffer[o + x + y * VBE_MODE_INFO->width].p = (struct pixel){.r = 255, .g = 255, .b = 255}; + blit_pixel(o + + y * VBE_MODE_INFO->pitch + + x * VBE_MODE_INFO->bpp / 8, + (struct pixel){.r = 255, .g = 255, .b = 255}); } - - blit(0, VBE_MODE_INFO->width, 0, VBE_MODE_INFO->height); } static inline void draw_hz_line(uint16_t y, uint16_t xs, uint16_t xm, struct super_pixel value) { |