# HG changeset patch # User Sam Lantinga # Date 1260772527 0 # Node ID 7184580ab75612ede306f91744c677c24c598336 # Parent 9c2e92de786ad8f4cc7765a2febee05b3157a704 Added support for SDL_PIXELFORMAT_RGB24 and SDL_PIXELFORMAT_BGR24 to SDL_PixelFormatEnumToMasks() diff -r 9c2e92de786a -r 7184580ab756 src/video/SDL_pixels.c --- a/src/video/SDL_pixels.c Mon Dec 14 04:19:00 2009 +0000 +++ b/src/video/SDL_pixels.c Mon Dec 14 06:35:27 2009 +0000 @@ -53,6 +53,32 @@ } *Rmask = *Gmask = *Bmask = *Amask = 0; + if (format == SDL_PIXELFORMAT_RGB24) { +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + *Rmask = 0x00FF0000; + *Gmask = 0x0000FF00; + *Bmask = 0x000000FF; +#else + *Rmask = 0x000000FF; + *Gmask = 0x0000FF00; + *Bmask = 0x00FF0000; +#endif + return SDL_TRUE; + } + + if (format == SDL_PIXELFORMAT_BGR24) { +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + *Rmask = 0x000000FF; + *Gmask = 0x0000FF00; + *Bmask = 0x00FF0000; +#else + *Rmask = 0x00FF0000; + *Gmask = 0x0000FF00; + *Bmask = 0x000000FF; +#endif + return SDL_TRUE; + } + if (SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED8 && SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED16 && SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED32) {