From a91f1a1adcb9567fbf2be5879e3c8401878d7e0e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 9 Jul 2014 00:01:34 -0400 Subject: [PATCH] Make SDL_LoadBMP() work with 32-bit bitmaps from ImageMagick. --- src/video/SDL_bmp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index 797863550..670821175 100644 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -246,6 +246,16 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) Gmask = SDL_ReadLE32(src); Bmask = SDL_ReadLE32(src); Amask = SDL_ReadLE32(src); + + /* ImageMagick seems to put out bogus masks here. Pick a default. */ + if ((Rmask == 0xFFFFFF) && (Gmask == 0xFFFFFF) && + (Bmask == 0xFFFFFF) && (Amask == 0xFFFFFF) ) { + Amask = 0xFF000000; + Rmask = 0x00FF0000; + Gmask = 0x0000FF00; + Bmask = 0x000000FF; + } + break; default: break;