Mercurial > sdl-ios-xcode
diff src/video/SDL_bmp.c @ 2807:365fe1a2aad5
The SDL_RLEACCEL flag is respected in SDL_ConvertSurface(), per the docs.
Fixed saving BMP files of surfaces with an alpha channel.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 29 Nov 2008 11:26:01 +0000 |
parents | c121d94672cb |
children | 15e1dd1fff78 |
line wrap: on
line diff
--- a/src/video/SDL_bmp.c Sat Nov 29 11:24:18 2008 +0000 +++ b/src/video/SDL_bmp.c Sat Nov 29 11:26:01 2008 +0000 @@ -382,26 +382,22 @@ ) { surface = saveme; } else { - SDL_Rect bounds; + SDL_PixelFormat *format; /* Convert to 24 bits per pixel */ - surface = SDL_CreateRGBSurface(0, saveme->w, saveme->h, 24, + format = SDL_AllocFormat(24, #if SDL_BYTEORDER == SDL_LIL_ENDIAN - 0x00FF0000, 0x0000FF00, 0x000000FF, + 0x00FF0000, 0x0000FF00, 0x000000FF, #else - 0x000000FF, 0x0000FF00, 0x00FF0000, + 0x000000FF, 0x0000FF00, 0x00FF0000, #endif - 0); - if (surface != NULL) { - bounds.x = 0; - bounds.y = 0; - bounds.w = saveme->w; - bounds.h = saveme->h; - if (SDL_LowerBlit(saveme, &bounds, surface, &bounds) < 0) { - SDL_FreeSurface(surface); + 0); + if (format != NULL) { + surface = SDL_ConvertSurface(saveme, format, 0); + if (!surface) { SDL_SetError("Couldn't convert image to 24 bpp"); - surface = NULL; } + SDL_FreeFormat(format); } } }