diff --git a/stepmania/src/SDL_utils.cpp b/stepmania/src/SDL_utils.cpp index 7c17507266..b2f8e28379 100644 --- a/stepmania/src/SDL_utils.cpp +++ b/stepmania/src/SDL_utils.cpp @@ -161,8 +161,22 @@ void ConvertSDLSurface(SDL_Surface *&image, /* I'd really like to do away with this, but a lot of song images use it. * I suppose this should be yet another hint, but they're getting cumbersome ... */ - if(!(image->flags & SDL_SRCCOLORKEY)) - SDL_SetColorKey( image, SDL_SRCCOLORKEY, SDL_MapRGB(image->format, 0xFF, 0, 0xFF)); + if(!(image->flags & SDL_SRCCOLORKEY)) { + /* Annoying: SDL will do a nearest-match on paletted images if + * they don't have the color we ask for, so images without HOT PINK + * will get some other random color transparent; so we have to make + * sure the value returned for paletted images is exactly #FF00FF. */ + int color = SDL_MapRGB(image->format, 0xFF, 0, 0xFF); + if( image->format->BitsPerPixel == 8 ) { + if(image->format->palette->colors[color].r != 0xFF || + image->format->palette->colors[color].g != 0x00 || + image->format->palette->colors[color].b != 0xFF ) + color = -1; + } + + if( color != -1 ) + SDL_SetColorKey( image, SDL_SRCCOLORKEY, color); + } /* We don't want to actually blend the alpha channel over the destination converted * surface; we want to simply blit it, so make sure SDL_SRCALPHA is not on. */