[video] Really need to fix this 24-bit-color stuff...

This commit is contained in:
Kevin Lange 2011-12-25 22:37:13 -06:00
parent 72b7589623
commit 3023d58a7f
2 changed files with 10 additions and 6 deletions

View File

@ -38,9 +38,7 @@ typedef struct sprite {
sprite_t * cursor;
uint32_t rgb(uint8_t r, uint8_t g, uint8_t b) {
return (r * 0x10000) + (g * 0x100) + (b * 0x1);
}
#define rgb(r,g,b) (((r) << 16) + ((g) << 8) + ((b)))
uint32_t alpha_blend(uint32_t bottom, uint32_t top, uint32_t mask) {
float a = _RED(mask) / 256.0;

View File

@ -372,7 +372,13 @@ bochs_set_point(
uint16_t y,
uint32_t color
) {
*((uint32_t *)&bochs_vid_memory[((y + current_scroll) * bochs_resolution_x + x) * (bochs_resolution_b / 8)]) = color;
if (bochs_resolution_b == 32) {
*((uint32_t *)&bochs_vid_memory[((y + current_scroll) * bochs_resolution_x + x) * 4]) = color;
} else if (bochs_resolution_b == 24) {
bochs_vid_memory[((y + current_scroll) * bochs_resolution_x + x) * 3 + 2] = _RED(color);
bochs_vid_memory[((y + current_scroll) * bochs_resolution_x + x) * 3 + 1] = _GRE(color);
bochs_vid_memory[((y + current_scroll) * bochs_resolution_x + x) * 3 + 0] = _BLU(color);
}
}
static inline void
@ -382,9 +388,9 @@ bochs_set_point_bg(
uint32_t color
) {
if (!color && wallpaper && y < wallpaper->height && x < wallpaper->width) {
*((uint32_t *)&bochs_vid_memory[((y + current_scroll) * bochs_resolution_x + x) * (bochs_resolution_b / 8)]) = wallpaper->bitmap[wallpaper->width * y + x];
bochs_set_point(x,y,wallpaper->bitmap[wallpaper->width * y + x]);
} else {
*((uint32_t *)&bochs_vid_memory[((y + current_scroll) * bochs_resolution_x + x) * (bochs_resolution_b / 8)]) = color;
bochs_set_point(x,y,color);
}
}