diff --git a/src/bmp.c b/src/bmp.c index 96a2b3f..e9bc6a3 100644 --- a/src/bmp.c +++ b/src/bmp.c @@ -56,10 +56,9 @@ typedef struct tagRGBQUAD { * arrange horizontal pixel data, add extra space in the dest buffer * for every line */ -static void raw_data_format_adjust_24bpp(u8 *src, u8 *dest, int width, - int height, int bytes_per_line_dest) +static void raw_data_format_adjust(u8 *src, u8 *dest, int width, + int height, int bytes_per_line_src, int bytes_per_line_dest) { - int bytes_per_line_src = 3 * width; int i; for (i = 0 ; i < height ; i++) { memcpy(dest + i * bytes_per_line_dest, @@ -95,10 +94,11 @@ int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size) } /* get bmp properties */ -void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height) +void bmp_get_info(struct bmp_decdata *bmp, int *width, int *height, int *bpp) { *width = bmp->width; *height = bmp->height; + *bpp = bmp->bpp; } /* flush flat picture data to *pc */ @@ -107,10 +107,14 @@ int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width { if (bmp->datap == pic) return 0; - /* now only support 24bpp bmp file */ if ((depth == 24) && (bmp->bpp == 24)) { - raw_data_format_adjust_24bpp(bmp->datap, pic, width, height, - bytes_per_line_dest); + raw_data_format_adjust(bmp->datap, pic, width, height, + 3*width, bytes_per_line_dest); + return 0; + } + if ((depth == 32) && (bmp->bpp == 32)) { + raw_data_format_adjust(bmp->datap, pic, width, height, + 4*width, bytes_per_line_dest); return 0; } return 1; diff --git a/src/bootsplash.c b/src/bootsplash.c index 165c98d..fe1ffa5 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -172,10 +172,9 @@ enable_bootsplash(void) dprintf(1, "bmp_decode failed with return code %d...\n", ret); goto done; } - bmp_get_size(bmp, &width, &height); - bpp_require = 24; + bmp_get_info(bmp, &width, &height, &bpp_require); } - /* jpeg would use 16 or 24 bpp video mode, BMP use 24bpp mode only */ + /* jpeg would use 16 or 24 bpp video mode, BMP uses 24 or 32 bpp mode */ // Try to find a graphics mode with the corresponding dimensions. int videomode = find_videomode(vesa_info, mode_info, width, height, diff --git a/src/util.h b/src/util.h index 8269057..4880d2d 100644 --- a/src/util.h +++ b/src/util.h @@ -12,7 +12,7 @@ void handle_1553(struct bregs *regs); // bmp.c struct bmp_decdata *bmp_alloc(void); int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size); -void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height); +void bmp_get_info(struct bmp_decdata *bmp, int *width, int *height, int *bpp); int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width , int height, int depth, int bytes_per_line_dest);