Support for 24 bpp pixel formats has been added.
authorMike Gorchak <lestat@i.com.ua>
Wed, 10 Jun 2009 05:51:44 +0000
changeset 31829f82979eaaf0
parent 3181 030899df1af5
child 3183 d1436442215f
Support for 24 bpp pixel formats has been added.
src/video/SDL_pixels.c
     1.1 --- a/src/video/SDL_pixels.c	Tue Jun 09 19:39:23 2009 +0000
     1.2 +++ b/src/video/SDL_pixels.c	Wed Jun 10 05:51:44 2009 +0000
     1.3 @@ -39,7 +39,7 @@
     1.4      Uint32 masks[4];
     1.5  
     1.6      /* Initialize the values here */
     1.7 -    if (SDL_BITSPERPIXEL(format) == 24) {
     1.8 +    if (SDL_BYTESPERPIXEL(format) == 3) {
     1.9          *bpp = SDL_BYTESPERPIXEL(format) * 8;
    1.10      } else {
    1.11          *bpp = SDL_BITSPERPIXEL(format);
    1.12 @@ -203,6 +203,17 @@
    1.13              return SDL_PIXELFORMAT_RGB565;
    1.14          }
    1.15          break;
    1.16 +    case 24:
    1.17 +        switch (Rmask) {
    1.18 +        case 0x00FF0000:
    1.19 +            return SDL_PIXELFORMAT_RGB888;
    1.20 +        case 0x000000FF:
    1.21 +            return SDL_PIXELFORMAT_BGR888;
    1.22 +        case 0x00000000:
    1.23 +            /* FIXME: At this point we can't distinguish */
    1.24 +            /* if this format is RGB24 or BGR24          */
    1.25 +            return SDL_PIXELFORMAT_RGB24;
    1.26 +        }
    1.27      case 32:
    1.28          switch (Rmask) {
    1.29          case 0xFF000000: