fbterm: Support 24bpp framebuffers

This commit is contained in:
K. Lange 2021-10-25 13:50:08 +09:00
parent 8839e4357c
commit 95ef9f02ac

View File

@ -48,7 +48,13 @@ static uint32_t bg_color = BG_COLOR;
extern uint32_t lfb_resolution_s;
static inline void set_point(int x, int y, uint32_t value) {
((uint32_t*)lfb_vid_memory)[y * (lfb_resolution_s/4) + x] = value;
if (lfb_resolution_b == 32) {
((uint32_t*)lfb_vid_memory)[y * (lfb_resolution_s/4) + x] = value;
} else if (lfb_resolution_b == 24) {
lfb_vid_memory[y * lfb_resolution_s + x * 3 + 0] = (value >> 0) & 0xFF;
lfb_vid_memory[y * lfb_resolution_s + x * 3 + 1] = (value >> 8) & 0xFF;
lfb_vid_memory[y * lfb_resolution_s + x * 3 + 2] = (value >> 16) & 0xFF;
}
}
static void fb_write_char(int _x, int _y, int val, uint32_t color) {