summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2011-11-09 22:53:44 -0500
committerSam Lantinga <slouken@libsdl.org>2011-11-09 22:53:44 -0500
commit46a4af76c11f52b658c34c7087ef379d375db845 (patch)
tree6b32c8dbde32e34e9dc8636d64fd12fe3e8d1f34
parent1840af6dc379fe3143f33ce882ab8ed8ab539ef9 (diff)
GIMP wrote bmp files in RGBX format. Huh.
-rw-r--r--include/SDL_pixels.h6
-rw-r--r--src/video/SDL_pixels.c14
2 files changed, 20 insertions, 0 deletions
diff --git a/include/SDL_pixels.h b/include/SDL_pixels.h
index ede9e292..5939d2c7 100644
--- a/include/SDL_pixels.h
+++ b/include/SDL_pixels.h
@@ -212,9 +212,15 @@ enum
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),
diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c
index e2005302..00ba9837 100644
--- a/src/video/SDL_pixels.c
+++ b/src/video/SDL_pixels.c
@@ -109,7 +109,9 @@ SDL_GetPixelFormatName(Uint32 format)
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 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
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 &&