no mouse on you may power off screen

This commit is contained in:
Benji Dial 2021-03-04 14:24:47 -05:00
parent 2fc7683198
commit 922470255b

View file

@ -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) {