GIMP wrote bmp files in RGBX format. Huh.
authorSam Lantinga <slouken@libsdl.org>
Wed, 09 Nov 2011 22:53:44 -0500
changeset 6074 3e1323cbb807
parent 6073 9738f2a8eee4
child 6075 a682a5c9a941
GIMP wrote bmp files in RGBX format. Huh.
include/SDL_pixels.h
src/video/SDL_pixels.c
--- a/include/SDL_pixels.h	Wed Nov 09 02:35:49 2011 -0500
+++ b/include/SDL_pixels.h	Wed Nov 09 22:53:44 2011 -0500
@@ -212,9 +212,15 @@
     SDL_PIXELFORMAT_RGB888 =
         SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
                                SDL_PACKEDLAYOUT_8888, 24, 4),
+    SDL_PIXELFORMAT_RGBX8888 =
+        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
+                               SDL_PACKEDLAYOUT_8888, 24, 4),
     SDL_PIXELFORMAT_BGR888 =
         SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
                                SDL_PACKEDLAYOUT_8888, 24, 4),
+    SDL_PIXELFORMAT_BGRX8888 =
+        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
+                               SDL_PACKEDLAYOUT_8888, 24, 4),
     SDL_PIXELFORMAT_ARGB8888 =
         SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
                                SDL_PACKEDLAYOUT_8888, 32, 4),
--- a/src/video/SDL_pixels.c	Wed Nov 09 02:35:49 2011 -0500
+++ b/src/video/SDL_pixels.c	Wed Nov 09 22:53:44 2011 -0500
@@ -109,7 +109,9 @@
     CASE(SDL_PIXELFORMAT_RGB24)
     CASE(SDL_PIXELFORMAT_BGR24)
     CASE(SDL_PIXELFORMAT_RGB888)
+    CASE(SDL_PIXELFORMAT_RGBX8888)
     CASE(SDL_PIXELFORMAT_BGR888)
+    CASE(SDL_PIXELFORMAT_BGRX8888)
     CASE(SDL_PIXELFORMAT_ARGB8888)
     CASE(SDL_PIXELFORMAT_RGBA8888)
     CASE(SDL_PIXELFORMAT_ABGR8888)
@@ -426,12 +428,24 @@
             Amask == 0x00000000) {
             return SDL_PIXELFORMAT_RGB888;
         }
+        if (Rmask == 0xFF000000 &&
+            Gmask == 0x00FF0000 &&
+            Bmask == 0x0000FF00 &&
+            Amask == 0x00000000) {
+            return SDL_PIXELFORMAT_RGBX8888;
+        }
         if (Rmask == 0x000000FF &&
             Gmask == 0x0000FF00 &&
             Bmask == 0x00FF0000 &&
             Amask == 0x00000000) {
             return SDL_PIXELFORMAT_BGR888;
         }
+        if (Rmask == 0x0000FF00 &&
+            Gmask == 0x00FF0000 &&
+            Bmask == 0xFF000000 &&
+            Amask == 0x00000000) {
+            return SDL_PIXELFORMAT_BGRX8888;
+        }
         if (Rmask == 0x00FF0000 &&
             Gmask == 0x0000FF00 &&
             Bmask == 0x000000FF &&