Added names for the newly supported pixel formats

main
Sam Lantinga 2024-02-24 20:13:59 -08:00
parent f6c42406cd
commit a1ea706215
2 changed files with 27 additions and 108 deletions

View File

@ -972,115 +972,14 @@ static void SDLTest_PrintRendererFlag(char *text, size_t maxlen, Uint32 flag)
static void SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format) static void SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format)
{ {
switch (format) { const char *name = SDL_GetPixelFormatName(format);
case SDL_PIXELFORMAT_UNKNOWN: if (name) {
SDL_snprintfcat(text, maxlen, "Unknown"); if (SDL_strncmp(name, "SDL_PIXELFORMAT_", 16) == 0) {
break; name += 16;
case SDL_PIXELFORMAT_INDEX1LSB: }
SDL_snprintfcat(text, maxlen, "Index1LSB"); SDL_snprintfcat(text, maxlen, name);
break; } else {
case SDL_PIXELFORMAT_INDEX1MSB:
SDL_snprintfcat(text, maxlen, "Index1MSB");
break;
case SDL_PIXELFORMAT_INDEX2LSB:
SDL_snprintfcat(text, maxlen, "Index2LSB");
break;
case SDL_PIXELFORMAT_INDEX2MSB:
SDL_snprintfcat(text, maxlen, "Index2MSB");
break;
case SDL_PIXELFORMAT_INDEX4LSB:
SDL_snprintfcat(text, maxlen, "Index4LSB");
break;
case SDL_PIXELFORMAT_INDEX4MSB:
SDL_snprintfcat(text, maxlen, "Index4MSB");
break;
case SDL_PIXELFORMAT_INDEX8:
SDL_snprintfcat(text, maxlen, "Index8");
break;
case SDL_PIXELFORMAT_RGB332:
SDL_snprintfcat(text, maxlen, "RGB332");
break;
case SDL_PIXELFORMAT_RGB444:
SDL_snprintfcat(text, maxlen, "RGB444");
break;
case SDL_PIXELFORMAT_BGR444:
SDL_snprintfcat(text, maxlen, "BGR444");
break;
case SDL_PIXELFORMAT_RGB555:
SDL_snprintfcat(text, maxlen, "RGB555");
break;
case SDL_PIXELFORMAT_BGR555:
SDL_snprintfcat(text, maxlen, "BGR555");
break;
case SDL_PIXELFORMAT_ARGB4444:
SDL_snprintfcat(text, maxlen, "ARGB4444");
break;
case SDL_PIXELFORMAT_ABGR4444:
SDL_snprintfcat(text, maxlen, "ABGR4444");
break;
case SDL_PIXELFORMAT_ARGB1555:
SDL_snprintfcat(text, maxlen, "ARGB1555");
break;
case SDL_PIXELFORMAT_ABGR1555:
SDL_snprintfcat(text, maxlen, "ABGR1555");
break;
case SDL_PIXELFORMAT_RGB565:
SDL_snprintfcat(text, maxlen, "RGB565");
break;
case SDL_PIXELFORMAT_BGR565:
SDL_snprintfcat(text, maxlen, "BGR565");
break;
case SDL_PIXELFORMAT_RGB24:
SDL_snprintfcat(text, maxlen, "RGB24");
break;
case SDL_PIXELFORMAT_BGR24:
SDL_snprintfcat(text, maxlen, "BGR24");
break;
case SDL_PIXELFORMAT_XRGB8888:
SDL_snprintfcat(text, maxlen, "XRGB8888");
break;
case SDL_PIXELFORMAT_XBGR8888:
SDL_snprintfcat(text, maxlen, "XBGR8888");
break;
case SDL_PIXELFORMAT_ARGB8888:
SDL_snprintfcat(text, maxlen, "ARGB8888");
break;
case SDL_PIXELFORMAT_RGBA8888:
SDL_snprintfcat(text, maxlen, "RGBA8888");
break;
case SDL_PIXELFORMAT_ABGR8888:
SDL_snprintfcat(text, maxlen, "ABGR8888");
break;
case SDL_PIXELFORMAT_BGRA8888:
SDL_snprintfcat(text, maxlen, "BGRA8888");
break;
case SDL_PIXELFORMAT_ARGB2101010:
SDL_snprintfcat(text, maxlen, "ARGB2101010");
break;
case SDL_PIXELFORMAT_YV12:
SDL_snprintfcat(text, maxlen, "YV12");
break;
case SDL_PIXELFORMAT_IYUV:
SDL_snprintfcat(text, maxlen, "IYUV");
break;
case SDL_PIXELFORMAT_YUY2:
SDL_snprintfcat(text, maxlen, "YUY2");
break;
case SDL_PIXELFORMAT_UYVY:
SDL_snprintfcat(text, maxlen, "UYVY");
break;
case SDL_PIXELFORMAT_YVYU:
SDL_snprintfcat(text, maxlen, "YVYU");
break;
case SDL_PIXELFORMAT_NV12:
SDL_snprintfcat(text, maxlen, "NV12");
break;
case SDL_PIXELFORMAT_NV21:
SDL_snprintfcat(text, maxlen, "NV21");
break;
default:
SDL_snprintfcat(text, maxlen, "0x%8.8x", format); SDL_snprintfcat(text, maxlen, "0x%8.8x", format);
break;
} }
} }

View File

@ -123,6 +123,24 @@ const char *SDL_GetPixelFormatName(Uint32 format)
CASE(SDL_PIXELFORMAT_XBGR2101010) CASE(SDL_PIXELFORMAT_XBGR2101010)
CASE(SDL_PIXELFORMAT_ARGB2101010) CASE(SDL_PIXELFORMAT_ARGB2101010)
CASE(SDL_PIXELFORMAT_ABGR2101010) CASE(SDL_PIXELFORMAT_ABGR2101010)
CASE(SDL_PIXELFORMAT_RGB48)
CASE(SDL_PIXELFORMAT_BGR48)
CASE(SDL_PIXELFORMAT_RGBA64)
CASE(SDL_PIXELFORMAT_ARGB64)
CASE(SDL_PIXELFORMAT_BGRA64)
CASE(SDL_PIXELFORMAT_ABGR64)
CASE(SDL_PIXELFORMAT_RGB48_FLOAT)
CASE(SDL_PIXELFORMAT_BGR48_FLOAT)
CASE(SDL_PIXELFORMAT_RGBA64_FLOAT)
CASE(SDL_PIXELFORMAT_ARGB64_FLOAT)
CASE(SDL_PIXELFORMAT_BGRA64_FLOAT)
CASE(SDL_PIXELFORMAT_ABGR64_FLOAT)
CASE(SDL_PIXELFORMAT_RGB96_FLOAT)
CASE(SDL_PIXELFORMAT_BGR96_FLOAT)
CASE(SDL_PIXELFORMAT_RGBA128_FLOAT)
CASE(SDL_PIXELFORMAT_ARGB128_FLOAT)
CASE(SDL_PIXELFORMAT_BGRA128_FLOAT)
CASE(SDL_PIXELFORMAT_ABGR128_FLOAT)
CASE(SDL_PIXELFORMAT_YV12) CASE(SDL_PIXELFORMAT_YV12)
CASE(SDL_PIXELFORMAT_IYUV) CASE(SDL_PIXELFORMAT_IYUV)
CASE(SDL_PIXELFORMAT_YUY2) CASE(SDL_PIXELFORMAT_YUY2)
@ -130,6 +148,8 @@ const char *SDL_GetPixelFormatName(Uint32 format)
CASE(SDL_PIXELFORMAT_YVYU) CASE(SDL_PIXELFORMAT_YVYU)
CASE(SDL_PIXELFORMAT_NV12) CASE(SDL_PIXELFORMAT_NV12)
CASE(SDL_PIXELFORMAT_NV21) CASE(SDL_PIXELFORMAT_NV21)
CASE(SDL_PIXELFORMAT_P010)
CASE(SDL_PIXELFORMAT_P016)
CASE(SDL_PIXELFORMAT_EXTERNAL_OES) CASE(SDL_PIXELFORMAT_EXTERNAL_OES)
default: default: