Be explicit that we support the MSB variants of the 1bpp and 4bpp surface formats

Fixes https://github.com/libsdl-org/SDL/issues/6242
main
Sam Lantinga 2022-11-28 09:06:44 -08:00
parent 4f5e9fd5bd
commit 62f4fc6f35
1 changed files with 20 additions and 21 deletions

View File

@ -525,7 +525,7 @@ SDL_CalculateBlit0(SDL_Surface * surface)
int which; int which;
/* 4bits to 32bits */ /* 4bits to 32bits */
if (surface->format->BitsPerPixel == 4) { if (surface->format->format == SDL_PIXELFORMAT_INDEX4MSB) {
if (surface->map->dst->format->BytesPerPixel == 4) { if (surface->map->dst->format->BytesPerPixel == 4) {
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
case 0: case 0:
@ -535,14 +535,10 @@ SDL_CalculateBlit0(SDL_Surface * surface)
return Blit4bto4Key; return Blit4bto4Key;
} }
} }
/* We don't fully support 4-bit packed pixel modes */
return NULL; return NULL;
} }
if (surface->format->BitsPerPixel != 1) { if (surface->format->format == SDL_PIXELFORMAT_INDEX1MSB) {
/* We don't support sub 8-bit packed pixel modes */
return (SDL_BlitFunc) NULL;
}
if (surface->map->dst->format->BitsPerPixel < 8) { if (surface->map->dst->format->BitsPerPixel < 8) {
which = 0; which = 0;
} else { } else {
@ -561,7 +557,10 @@ SDL_CalculateBlit0(SDL_Surface * surface)
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
return which >= 2 ? BlitBtoNAlphaKey : (SDL_BlitFunc) NULL; return which >= 2 ? BlitBtoNAlphaKey : (SDL_BlitFunc) NULL;
} }
return (SDL_BlitFunc) NULL; return NULL;
}
return NULL;
} }
#endif /* SDL_HAVE_BLIT_0 */ #endif /* SDL_HAVE_BLIT_0 */