src/video/SDL_bmp.c
changeset 2807 365fe1a2aad5
parent 1895 c121d94672cb
child 2823 15e1dd1fff78
     1.1 --- a/src/video/SDL_bmp.c	Sat Nov 29 11:24:18 2008 +0000
     1.2 +++ b/src/video/SDL_bmp.c	Sat Nov 29 11:26:01 2008 +0000
     1.3 @@ -382,26 +382,22 @@
     1.4              ) {
     1.5              surface = saveme;
     1.6          } else {
     1.7 -            SDL_Rect bounds;
     1.8 +            SDL_PixelFormat *format;
     1.9  
    1.10              /* Convert to 24 bits per pixel */
    1.11 -            surface = SDL_CreateRGBSurface(0, saveme->w, saveme->h, 24,
    1.12 +            format = SDL_AllocFormat(24,
    1.13  #if SDL_BYTEORDER == SDL_LIL_ENDIAN
    1.14 -                                           0x00FF0000, 0x0000FF00, 0x000000FF,
    1.15 +                                     0x00FF0000, 0x0000FF00, 0x000000FF,
    1.16  #else
    1.17 -                                           0x000000FF, 0x0000FF00, 0x00FF0000,
    1.18 +                                     0x000000FF, 0x0000FF00, 0x00FF0000,
    1.19  #endif
    1.20 -                                           0);
    1.21 -            if (surface != NULL) {
    1.22 -                bounds.x = 0;
    1.23 -                bounds.y = 0;
    1.24 -                bounds.w = saveme->w;
    1.25 -                bounds.h = saveme->h;
    1.26 -                if (SDL_LowerBlit(saveme, &bounds, surface, &bounds) < 0) {
    1.27 -                    SDL_FreeSurface(surface);
    1.28 +                                     0);
    1.29 +            if (format != NULL) {
    1.30 +                surface = SDL_ConvertSurface(saveme, format, 0);
    1.31 +                if (!surface) {
    1.32                      SDL_SetError("Couldn't convert image to 24 bpp");
    1.33 -                    surface = NULL;
    1.34                  }
    1.35 +                SDL_FreeFormat(format);
    1.36              }
    1.37          }
    1.38      }