The SDL_RLEACCEL flag is respected in SDL_ConvertSurface(), per the docs.

Fixed saving BMP files of surfaces with an alpha channel.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403268
This commit is contained in:
Sam Lantinga 2008-11-29 11:26:01 +00:00
parent 7a4a712978
commit fb253660b5
4 changed files with 21 additions and 25 deletions

View file

@ -41,6 +41,9 @@ SDL_CreateRGBSurface(Uint32 flags,
{
SDL_Surface *surface;
/* The flags are no longer used, make the compiler happy */
flags;
/* Allocate the surface */
surface = (SDL_Surface *) SDL_calloc(1, sizeof(*surface));
if (surface == NULL) {
@ -754,8 +757,8 @@ SDL_UnlockSurface(SDL_Surface * surface)
* Convert a surface into the specified pixel format.
*/
SDL_Surface *
SDL_ConvertSurface(SDL_Surface * surface,
SDL_PixelFormat * format, Uint32 flags)
SDL_ConvertSurface(SDL_Surface * surface, SDL_PixelFormat * format,
Uint32 flags)
{
SDL_Surface *convert;
Uint32 copy_flags;
@ -777,7 +780,7 @@ SDL_ConvertSurface(SDL_Surface * surface,
}
/* Create a new surface with the desired format */
convert = SDL_CreateRGBSurface(0, surface->w, surface->h,
convert = SDL_CreateRGBSurface(flags, surface->w, surface->h,
format->BitsPerPixel, format->Rmask,
format->Gmask, format->Bmask,
format->Amask);
@ -827,6 +830,7 @@ SDL_ConvertSurface(SDL_Surface * surface,
if (format->Amask || (copy_flags & SDL_COPY_MODULATE_ALPHA)) {
SDL_SetSurfaceBlendMode(convert, SDL_TEXTUREBLENDMODE_BLEND);
}
SDL_SetSurfaceRLE(convert, (flags & SDL_RLEACCEL));
/* We're ready to go! */
return (convert);