Added support for SDL_PIXELFORMAT_RGB24 and SDL_PIXELFORMAT_BGR24 to SDL_PixelFormatEnumToMasks()
authorSam Lantinga <slouken@libsdl.org>
Mon, 14 Dec 2009 06:35:27 +0000
changeset 35577184580ab756
parent 3556 9c2e92de786a
child 3558 5f038ec1a1af
Added support for SDL_PIXELFORMAT_RGB24 and SDL_PIXELFORMAT_BGR24 to SDL_PixelFormatEnumToMasks()
src/video/SDL_pixels.c
     1.1 --- a/src/video/SDL_pixels.c	Mon Dec 14 04:19:00 2009 +0000
     1.2 +++ b/src/video/SDL_pixels.c	Mon Dec 14 06:35:27 2009 +0000
     1.3 @@ -53,6 +53,32 @@
     1.4      }
     1.5      *Rmask = *Gmask = *Bmask = *Amask = 0;
     1.6  
     1.7 +    if (format == SDL_PIXELFORMAT_RGB24) {
     1.8 +#if SDL_BYTEORDER == SDL_BIG_ENDIAN
     1.9 +        *Rmask = 0x00FF0000;
    1.10 +        *Gmask = 0x0000FF00;
    1.11 +        *Bmask = 0x000000FF;
    1.12 +#else
    1.13 +        *Rmask = 0x000000FF;
    1.14 +        *Gmask = 0x0000FF00;
    1.15 +        *Bmask = 0x00FF0000;
    1.16 +#endif
    1.17 +        return SDL_TRUE;
    1.18 +    }
    1.19 +
    1.20 +    if (format == SDL_PIXELFORMAT_BGR24) {
    1.21 +#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    1.22 +        *Rmask = 0x000000FF;
    1.23 +        *Gmask = 0x0000FF00;
    1.24 +        *Bmask = 0x00FF0000;
    1.25 +#else
    1.26 +        *Rmask = 0x00FF0000;
    1.27 +        *Gmask = 0x0000FF00;
    1.28 +        *Bmask = 0x000000FF;
    1.29 +#endif
    1.30 +        return SDL_TRUE;
    1.31 +    }
    1.32 +
    1.33      if (SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED8 &&
    1.34          SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED16 &&
    1.35          SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED32) {