Fix blit with blending (Blit_A) to RGB332 which has no palette
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c
index 79ecc95..a04d1bc 100644
--- a/src/video/SDL_blit_A.c
+++ b/src/video/SDL_blit_A.c
@@ -1276,7 +1276,12 @@ SDL_CalculateBlitA(SDL_Surface * surface)
/* Per-pixel alpha blits */
switch (df->BytesPerPixel) {
case 1:
- return BlitNto1PixelAlpha;
+ if (df->palette != NULL) {
+ return BlitNto1PixelAlpha;
+ } else {
+ /* RGB332 has no palette ! */
+ return BlitNtoNPixelAlpha;
+ }
case 2:
if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000
@@ -1326,7 +1331,12 @@ SDL_CalculateBlitA(SDL_Surface * surface)
/* Per-surface alpha blits */
switch (df->BytesPerPixel) {
case 1:
- return BlitNto1SurfaceAlpha;
+ if (df->palette != NULL) {
+ return BlitNto1SurfaceAlpha;
+ } else {
+ /* RGB332 has no palette ! */
+ return BlitNtoNSurfaceAlpha;
+ }
case 2:
if (surface->map->identity) {
@@ -1374,7 +1384,13 @@ SDL_CalculateBlitA(SDL_Surface * surface)
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
if (sf->Amask == 0) {
if (df->BytesPerPixel == 1) {
- return BlitNto1SurfaceAlphaKey;
+
+ if (df->palette != NULL) {
+ return BlitNto1SurfaceAlphaKey;
+ } else {
+ /* RGB332 has no palette ! */
+ return BlitNtoNSurfaceAlphaKey;
+ }
} else {
return BlitNtoNSurfaceAlphaKey;
}