diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c index 1c1b0e150..fb134a10d 100644 --- a/src/SDL12_compat.c +++ b/src/SDL12_compat.c @@ -5003,12 +5003,19 @@ SDL_CreateRGBSurface(Uint32 flags12, int width, int height, int depth, Uint32 Rm a generic blitter that just copied data blindly. SDL2 wants more strict pixel formats, so try to detect this case and try again with a standard format. */ - if ((surface20 == NULL) && (depth >= 24) && (SDL20_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask) == SDL_PIXELFORMAT_UNKNOWN)) { + if ((surface20 == NULL) && (depth >= 16) && (SDL20_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask) == SDL_PIXELFORMAT_UNKNOWN)) { /* I have no illusions this is correct, it just works for the known problem cases so far. */ - Rmask = SDL_SwapLE32(0x000000FF); - Gmask = SDL_SwapLE32(0x0000FF00); - Bmask = SDL_SwapLE32(0x00FF0000); - Amask = SDL_SwapLE32(Amask ? 0xFF000000 : 0x00000000); + if (depth == 16) { + Rmask = SDL_SwapLE32(0x0000F800); + Gmask = SDL_SwapLE32(0x000007E0); + Bmask = SDL_SwapLE32(0x0000001F); + Amask = 0; + } else { + Rmask = SDL_SwapLE32(0x000000FF); + Gmask = SDL_SwapLE32(0x0000FF00); + Bmask = SDL_SwapLE32(0x00FF0000); + Amask = SDL_SwapLE32(Amask ? 0xFF000000 : 0x00000000); + } surface20 = SDL20_CreateRGBSurface(0, width, height, depth, Rmask, Gmask, Bmask, Amask); }