From c93e3b36074ddb2ed986cbacc5e9d4f3a60db343 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 28 Apr 2021 10:43:28 +0200 Subject: [PATCH] Fixed bug #2881 - SDL_RLEsurface may encode RGB888 if it has no color key (Thanks Simon Hug) To encode with BLEND mode, it needs a valid alpha channel --- src/video/SDL_RLEaccel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c index 32cf8e074..3f3b62cec 100644 --- a/src/video/SDL_RLEaccel.c +++ b/src/video/SDL_RLEaccel.c @@ -1423,9 +1423,12 @@ SDL_RLESurface(SDL_Surface * surface) return -1; } - /* If we don't have colorkey or blending, nothing to do... */ - flags = surface->map->info.flags; - if (!(flags & (SDL_COPY_COLORKEY | SDL_COPY_BLEND))) { + if (flags & SDL_COPY_COLORKEY) { + /* ok */ + } else if ((flags & SDL_COPY_BLEND) && surface->format->Amask) { + /* ok */ + } else { + /* If we don't have colorkey or blending, nothing to do... */ return -1; }