From b5cd0749b2d04fbab07be46a5167eac3083b04fb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 16 May 2023 14:38:44 -0400 Subject: [PATCH] blit: Add a case for 8-bit blits that sdl12-compat exposed. sdl12-compat can get into a state where a color-keyed surface is marked for blending, but wants to blend with full alpha (which is the same as _not_ blending), so rather than fail to find a blitter in that case, it just selects the colorkey blitter. Reference https://github.com/libsdl-org/sdl12-compat/issues/233 (cherry picked from commit 0eea92c8fcc4b5c572a0dd9848ca8886978ee0a2) --- src/video/SDL_blit_1.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/SDL_blit_1.c b/src/video/SDL_blit_1.c index f3f95abc79..c59a417622 100644 --- a/src/video/SDL_blit_1.c +++ b/src/video/SDL_blit_1.c @@ -531,6 +531,9 @@ SDL_CalculateBlit1(SDL_Surface *surface) case SDL_COPY_COLORKEY: return one_blitkey[which]; + case SDL_COPY_COLORKEY | SDL_COPY_BLEND: /* this is not super-robust but handles a specific case we found sdl12-compat. */ + return (surface->map->info.a == 255) ? one_blitkey[which] : (SDL_BlitFunc)NULL; + case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: /* Supporting 8bpp->8bpp alpha is doable but requires lots of tables which consume space and takes time to precompute,