diff src/video/SDL_surface.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 93764fe8601a
children 4dba7aa7ea77
line wrap: on
line diff
--- a/src/video/SDL_surface.c	Sat Nov 29 11:24:18 2008 +0000
+++ b/src/video/SDL_surface.c	Sat Nov 29 11:26:01 2008 +0000
@@ -41,6 +41,9 @@
 {
     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 @@
  * 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 @@
     }
 
     /* 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 @@
     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);