Added SDL_PIXELFORMAT_BGR444

This commit is contained in:
Cameron Cawley 2019-11-02 22:58:52 +00:00
parent a9ac9e3865
commit 20ddf45ede
5 changed files with 17 additions and 1 deletions

View File

@ -191,6 +191,9 @@ typedef enum
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_RGB444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_4444, 12, 2), SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_BGR444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_RGB555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_1555, 15, 2), SDL_PACKEDLAYOUT_1555, 15, 2),

View File

@ -577,6 +577,9 @@ SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format)
case SDL_PIXELFORMAT_RGB444: case SDL_PIXELFORMAT_RGB444:
SDL_snprintfcat(text, maxlen, "RGB444"); SDL_snprintfcat(text, maxlen, "RGB444");
break; break;
case SDL_PIXELFORMAT_BGR444:
SDL_snprintfcat(text, maxlen, "BGR444");
break;
case SDL_PIXELFORMAT_RGB555: case SDL_PIXELFORMAT_RGB555:
SDL_snprintfcat(text, maxlen, "RGB555"); SDL_snprintfcat(text, maxlen, "RGB555");
break; break;

View File

@ -94,6 +94,7 @@ SDL_GetPixelFormatName(Uint32 format)
CASE(SDL_PIXELFORMAT_INDEX8) CASE(SDL_PIXELFORMAT_INDEX8)
CASE(SDL_PIXELFORMAT_RGB332) CASE(SDL_PIXELFORMAT_RGB332)
CASE(SDL_PIXELFORMAT_RGB444) CASE(SDL_PIXELFORMAT_RGB444)
CASE(SDL_PIXELFORMAT_BGR444)
CASE(SDL_PIXELFORMAT_RGB555) CASE(SDL_PIXELFORMAT_RGB555)
CASE(SDL_PIXELFORMAT_BGR555) CASE(SDL_PIXELFORMAT_BGR555)
CASE(SDL_PIXELFORMAT_ARGB4444) CASE(SDL_PIXELFORMAT_ARGB4444)
@ -321,6 +322,12 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
Amask == 0x0000) { Amask == 0x0000) {
return SDL_PIXELFORMAT_RGB444; return SDL_PIXELFORMAT_RGB444;
} }
if (Rmask == 0x000F &&
Gmask == 0x00F0 &&
Bmask == 0x0F00 &&
Amask == 0x0000) {
return SDL_PIXELFORMAT_BGR444;
}
break; break;
case 15: case 15:
if (Rmask == 0) { if (Rmask == 0) {

View File

@ -10,7 +10,7 @@
/* Test case functions */ /* Test case functions */
/* Definition of all RGB formats used to test pixel conversions */ /* Definition of all RGB formats used to test pixel conversions */
const int _numRGBPixelFormats = 30; const int _numRGBPixelFormats = 31;
Uint32 _RGBPixelFormats[] = Uint32 _RGBPixelFormats[] =
{ {
SDL_PIXELFORMAT_INDEX1LSB, SDL_PIXELFORMAT_INDEX1LSB,
@ -20,6 +20,7 @@ Uint32 _RGBPixelFormats[] =
SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_RGB332, SDL_PIXELFORMAT_RGB332,
SDL_PIXELFORMAT_RGB444, SDL_PIXELFORMAT_RGB444,
SDL_PIXELFORMAT_BGR444,
SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_BGR555, SDL_PIXELFORMAT_BGR555,
SDL_PIXELFORMAT_ARGB4444, SDL_PIXELFORMAT_ARGB4444,
@ -53,6 +54,7 @@ char* _RGBPixelFormatsVerbose[] =
"SDL_PIXELFORMAT_INDEX8", "SDL_PIXELFORMAT_INDEX8",
"SDL_PIXELFORMAT_RGB332", "SDL_PIXELFORMAT_RGB332",
"SDL_PIXELFORMAT_RGB444", "SDL_PIXELFORMAT_RGB444",
"SDL_PIXELFORMAT_BGR444",
"SDL_PIXELFORMAT_RGB555", "SDL_PIXELFORMAT_RGB555",
"SDL_PIXELFORMAT_BGR555", "SDL_PIXELFORMAT_BGR555",
"SDL_PIXELFORMAT_ARGB4444", "SDL_PIXELFORMAT_ARGB4444",

View File

@ -310,6 +310,7 @@ surface_testCompleteSurfaceConversion(void *arg)
SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_RGB332, SDL_PIXELFORMAT_RGB332,
SDL_PIXELFORMAT_RGB444, SDL_PIXELFORMAT_RGB444,
SDL_PIXELFORMAT_BGR444,
SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_BGR555, SDL_PIXELFORMAT_BGR555,
SDL_PIXELFORMAT_ARGB4444, SDL_PIXELFORMAT_ARGB4444,