give default RGBA masks for depth 32 when masks not specified

This commit is contained in:
Vincent Wei
2022-09-24 14:33:49 +08:00
parent 9a124dec50
commit 67ccb2aafd

View File

@@ -76,6 +76,14 @@ GAL_PixelFormat *GAL_AllocFormat(int bpp,
//memset(format, 0, sizeof(*format));
format->alpha = GAL_ALPHA_OPAQUE;
/* Give defaults for the special case */
if (bpp == 32 && Rmask == 0 && Gmask == 0 && Bmask == 0 && Amask == 0) {
Amask = 0xFF000000;
Rmask = 0x00FF0000;
Gmask = 0x0000FF00;
Bmask = 0x000000FF;
}
/* Set up the format */
format->BitsPerPixel = bpp;
format->BytesPerPixel = (bpp+7)/8;