Skip to content

Commit

Permalink
Make SDL_LoadBMP() work with 32-bit bitmaps from ImageMagick.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 9, 2014
1 parent 0e9c085 commit a91f1a1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/video/SDL_bmp.c
Expand Up @@ -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;
Expand Down

0 comments on commit a91f1a1

Please sign in to comment.