SDL: Validate that pixel formats have the correct attributes

From e027b85cc457556071cbb2f3f1bcf8803c1bc001 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 17 Nov 2024 08:53:20 -0800
Subject: [PATCH] Validate that pixel formats have the correct attributes

Also added a test to save and load as BMP format to make sure pixel transformations are working correctly.

Fixes https://github.com/libsdl-org/SDL/issues/11483
---
 include/SDL3/SDL_pixels.h    |  19 +-
 src/video/SDL_bmp.c          |  13 +-
 src/video/SDL_surface.c      |   1 +
 test/testautomation_pixels.c | 735 +++++++++++++++++++++++++++++++----
 4 files changed, 677 insertions(+), 91 deletions(-)

diff --git a/include/SDL3/SDL_pixels.h b/include/SDL3/SDL_pixels.h
index 42957797b547e..eb6ff50181cc4 100644
--- a/include/SDL3/SDL_pixels.h
+++ b/include/SDL3/SDL_pixels.h
@@ -201,13 +201,6 @@ typedef enum SDL_PackedLayout
       (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
       (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
 
-#define SDL_ISPIXELFORMAT_ALPHA(format)   \
-    ((SDL_ISPIXELFORMAT_PACKED(format) && \
-     ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
-      (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
-      (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
-      (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))))
-
 #define SDL_ISPIXELFORMAT_10BIT(format)    \
       (!SDL_ISPIXELFORMAT_FOURCC(format) && \
        ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32) && \
@@ -218,6 +211,18 @@ typedef enum SDL_PackedLayout
        ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
         (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
 
+#define SDL_ISPIXELFORMAT_ALPHA(format)   \
+    ((SDL_ISPIXELFORMAT_PACKED(format) && \
+      ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
+       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
+       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
+       (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
+     (SDL_ISPIXELFORMAT_ARRAY(format) && \
+      ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
+       (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
+       (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
+       (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
+
 /* The flag is set to 1 because 0x1? is not in the printable ASCII range */
 #define SDL_ISPIXELFORMAT_FOURCC(format)    \
     ((format) && (SDL_PIXELFLAG(format) != 1))
diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c
index ebead13bdea62..b3df424726bc7 100644
--- a/src/video/SDL_bmp.c
+++ b/src/video/SDL_bmp.c
@@ -664,17 +664,8 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
                          SDL_BITSPERPIXEL(surface->format));
             goto done;
         }
-    } else if ((SDL_BITSPERPIXEL(surface->format) == 24) && !save32bit &&
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-               (surface->fmt->Rmask == 0x00FF0000) &&
-               (surface->fmt->Gmask == 0x0000FF00) &&
-               (surface->fmt->Bmask == 0x000000FF)
-#else
-               (surface->fmt->Rmask == 0x000000FF) &&
-               (surface->fmt->Gmask == 0x0000FF00) &&
-               (surface->fmt->Bmask == 0x00FF0000)
-#endif
-    ) {
+    } else if ((surface->format == SDL_PIXELFORMAT_BGR24 && !save32bit) ||
+               (surface->format == SDL_PIXELFORMAT_BGRA32 && save32bit)) {
         intermediate_surface = surface;
     } else {
         SDL_PixelFormat pixel_format;
diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
index 657d7f462cb2c..f4f907f3a0483 100644
--- a/src/video/SDL_surface.c
+++ b/src/video/SDL_surface.c
@@ -2597,6 +2597,7 @@ bool SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a)
             goto done;
         }
         SDL_SetSurfaceColorspace(tmp, surface->colorspace);
+        SDL_SetSurfaceBlendMode(tmp, SDL_BLENDMODE_NONE);
 
         float *pixels = (float *)tmp->pixels;
         pixels[0] = r;
diff --git a/test/testautomation_pixels.c b/test/testautomation_pixels.c
index 8769bd93c4abd..152b978efca07 100644
--- a/test/testautomation_pixels.c
+++ b/test/testautomation_pixels.c
@@ -101,6 +101,27 @@ static const char *g_AllFormatsVerbose[] = {
     "SDL_PIXELFORMAT_NV21"
 };
 
+static const SDL_PixelFormat g_AllLargeFormats[] = {
+    SDL_PIXELFORMAT_RGB48,
+    SDL_PIXELFORMAT_BGR48,
+    SDL_PIXELFORMAT_RGBA64,
+    SDL_PIXELFORMAT_ARGB64,
+    SDL_PIXELFORMAT_BGRA64,
+    SDL_PIXELFORMAT_ABGR64,
+    SDL_PIXELFORMAT_RGB48_FLOAT,
+    SDL_PIXELFORMAT_BGR48_FLOAT,
+    SDL_PIXELFORMAT_RGBA64_FLOAT,
+    SDL_PIXELFORMAT_ARGB64_FLOAT,
+    SDL_PIXELFORMAT_BGRA64_FLOAT,
+    SDL_PIXELFORMAT_ABGR64_FLOAT,
+    SDL_PIXELFORMAT_RGB96_FLOAT,
+    SDL_PIXELFORMAT_BGR96_FLOAT,
+    SDL_PIXELFORMAT_RGBA128_FLOAT,
+    SDL_PIXELFORMAT_ARGB128_FLOAT,
+    SDL_PIXELFORMAT_BGRA128_FLOAT,
+    SDL_PIXELFORMAT_ABGR128_FLOAT
+};
+
 /* Definition of some invalid formats for negative tests */
 static Uint32 g_invalidPixelFormats[] = {
     SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1010102 + 1, 32, 4),
@@ -114,68 +135,510 @@ static const char *g_invalidPixelFormatsVerbose[] = {
 
 /* Verify the pixel formats are laid out as expected */
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_FORMAT, SDL_PIXELFORMAT_INDEX1LSB == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, 1, 0));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_INDEX1LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_INDEXED, SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_INDEX1LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_INDEX1LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_INDEX1LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_INDEX1LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_INDEX1LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1LSB_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_INDEX1LSB));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_FORMAT, SDL_PIXELFORMAT_INDEX1MSB == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_INDEX1MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_INDEXED, SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_INDEX1MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_INDEX1MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_INDEX1MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_INDEX1MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_INDEX1MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX1MSB_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_INDEX1MSB));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_FORMAT, SDL_PIXELFORMAT_INDEX2LSB == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_4321, 0, 2, 0));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_INDEX2LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_INDEXED, SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_INDEX2LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_INDEX2LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_INDEX2LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_INDEX2LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_INDEX2LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2LSB_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_INDEX2LSB));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_FORMAT, SDL_PIXELFORMAT_INDEX2MSB == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_1234, 0, 2, 0));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_INDEX2MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_INDEXED, SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_INDEX2MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_INDEX2MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_INDEX2MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_INDEX2MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_INDEX2MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX2MSB_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_INDEX2MSB));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_FORMAT, SDL_PIXELFORMAT_INDEX4LSB == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, 4, 0));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_INDEX4LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_INDEXED, SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_INDEX4LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_INDEX4LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_INDEX4LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_INDEX4LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_INDEX4LSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4LSB_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_INDEX4LSB));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_FORMAT, SDL_PIXELFORMAT_INDEX4MSB == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, 4, 0));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_INDEX4MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_INDEXED, SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_INDEX4MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_INDEX4MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_INDEX4MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_INDEX4MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_INDEX4MSB));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX4MSB_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_INDEX4MSB));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_FORMAT, SDL_PIXELFORMAT_INDEX8 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_INDEX8));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_INDEXED, SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_INDEX8));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_INDEX8));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_INDEX8));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_INDEX8));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_INDEX8));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_INDEX8_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_INDEX8));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_FORMAT, SDL_PIXELFORMAT_RGB332 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_332, 8, 1));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_RGB332));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_RGB332));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_RGB332));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_RGB332));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_RGB332));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_RGB332));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB332_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_RGB332));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_FORMAT, SDL_PIXELFORMAT_XRGB4444 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_4444, 12, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_XRGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_XRGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_XRGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_XRGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_XRGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_XRGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB4444_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_XRGB4444));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_FORMAT, SDL_PIXELFORMAT_XBGR4444 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_4444, 12, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_XBGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_XBGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_XBGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_XBGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_XBGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_XBGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR4444_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_XBGR4444));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_FORMAT, SDL_PIXELFORMAT_XRGB1555 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_1555, 15, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_XRGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_XRGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_XRGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_XRGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_XRGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_XRGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB1555_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_XRGB1555));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_FORMAT, SDL_PIXELFORMAT_XBGR1555 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_1555, 15, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_XBGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_XBGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_XBGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_XBGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_XBGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_XBGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR1555_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_XBGR1555));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_FORMAT, SDL_PIXELFORMAT_ARGB4444 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_4444, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_ARGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_ARGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_ARGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_ARGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_ARGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_ARGB4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB4444_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_ARGB4444));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_FORMAT, SDL_PIXELFORMAT_RGBA4444 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_4444, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_RGBA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_RGBA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_RGBA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_RGBA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_RGBA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_RGBA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA4444_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_RGBA4444));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_FORMAT, SDL_PIXELFORMAT_ABGR4444 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_4444, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_ABGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_ABGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_ABGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_ABGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_ABGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_ABGR4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR4444_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_ABGR4444));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_FORMAT, SDL_PIXELFORMAT_BGRA4444 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_4444, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_BGRA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_BGRA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_BGRA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_BGRA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_BGRA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_BGRA4444));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA4444_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_BGRA4444));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_FORMAT, SDL_PIXELFORMAT_ARGB1555 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_1555, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_ARGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_ARGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_ARGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_ARGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_ARGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_ARGB1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ARGB1555_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_ARGB1555));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_FORMAT, SDL_PIXELFORMAT_RGBA5551 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_5551, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_RGBA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_RGBA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_RGBA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_RGBA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_RGBA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_RGBA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBA5551_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_RGBA5551));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_FORMAT, SDL_PIXELFORMAT_ABGR1555 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1555, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_ABGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_ABGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_ABGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_ABGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_ABGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_ABGR1555));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_ABGR1555_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_ABGR1555));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_FORMAT, SDL_PIXELFORMAT_BGRA5551 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_5551, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_BGRA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_BGRA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_BGRA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_BGRA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_BGRA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_BGRA5551));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRA5551_ALPHA, SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_BGRA5551));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_FORMAT, SDL_PIXELFORMAT_RGB565 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_565, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_RGB565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_RGB565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_RGB565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_RGB565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_RGB565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_RGB565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB565_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_RGB565));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_FORMAT, SDL_PIXELFORMAT_BGR565 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_565, 16, 2));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_BGR565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_BGR565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_BGR565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_BGR565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_BGR565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_BGR565));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR565_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_BGR565));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_FORMAT, SDL_PIXELFORMAT_RGB24 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, 24, 3));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_RGB24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_RGB24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_RGB24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_ARRAY, SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_RGB24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_RGB24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_RGB24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGB24_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_RGB24));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_FORMAT, SDL_PIXELFORMAT_BGR24 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, 24, 3));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_BGR24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_BGR24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_PACKED, !SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_BGR24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_ARRAY, SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_BGR24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_BGR24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_BGR24));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGR24_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_BGR24));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_FORMAT, SDL_PIXELFORMAT_XRGB8888 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_8888, 24, 4));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_XRGB8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_XRGB8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_XRGB8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_XRGB8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_XRGB8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_XRGB8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XRGB8888_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_XRGB8888));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_FORMAT, SDL_PIXELFORMAT_RGBX8888 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, SDL_PACKEDLAYOUT_8888, 24, 4));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_RGBX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_RGBX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_RGBX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_RGBX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_RGBX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_RGBX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_RGBX8888_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_RGBX8888));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_FORMAT, SDL_PIXELFORMAT_XBGR8888 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_8888, 24, 4));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_XBGR8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_XBGR8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_XBGR8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_XBGR8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_XBGR8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_FLOAT, !SDL_ISPIXELFORMAT_FLOAT(SDL_PIXELFORMAT_XBGR8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_XBGR8888_ALPHA, !SDL_ISPIXELFORMAT_ALPHA(SDL_PIXELFORMAT_XBGR8888));
 SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRX8888_FORMAT, SDL_PIXELFORMAT_BGRX8888 == SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, SDL_PACKEDLAYOUT_8888, 24, 4));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRX8888_FOURCC, !SDL_ISPIXELFORMAT_FOURCC(SDL_PIXELFORMAT_BGRX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRX8888_INDEXED, !SDL_ISPIXELFORMAT_INDEXED(SDL_PIXELFORMAT_BGRX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRX8888_PACKED, SDL_ISPIXELFORMAT_PACKED(SDL_PIXELFORMAT_BGRX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRX8888_ARRAY, !SDL_ISPIXELFORMAT_ARRAY(SDL_PIXELFORMAT_BGRX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRX8888_10BIT, !SDL_ISPIXELFORMAT_10BIT(SDL_PIXELFORMAT_BGRX8888));
+SDL_COMPILE_TIME_ASSERT(SDL_PIXELFORMAT_BGRX8888_FLOAT, !SDL_

(Patch may be truncated, please check the link at the top of this post.)