[Commits] SDL: Fixed bug 3309 - SDL_ConvertSurface adds AlphaMod when inpu...

libsdl.org revision control commits-owner at libsdl.org
Sat Aug 12 15:21:30 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/1667e6dafc85
changeset: 11246:1667e6dafc85
user:      Sam Lantinga <slouken at libsdl.org>
date:      Sat Aug 12 15:21:26 2017 -0700
description:
Fixed bug 3309 - SDL_ConvertSurface adds AlphaMod when input surface has ColorKey

Sylvain

Let's you have a SDL_Surface that has ColorKey, but no Alpha Modulation.
When this surface is duplicated with SDL_ConvertSurface function, the result has ColorKey and Alpha Modulation (BLEND, and Opaque 255).

I think SDL_ConvertSurface should strictly keeps the input format.


example
=======

SDL_Surface *input; // ... Set up a surface with ColorKey and no AlphaMod

SDL_Surface *output = SDL_ConvertSurface(input, input->format, input->flags);

// "output" surface has a ColorKey but *also* AlphaMod (BLEND, and Opaque 255).

diffstat:

 src/video/SDL_surface.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 283194179512 -r 1667e6dafc85 src/video/SDL_surface.c
--- a/src/video/SDL_surface.c	Sat Aug 12 15:00:33 2017 -0700
+++ b/src/video/SDL_surface.c	Sat Aug 12 15:21:26 2017 -0700
@@ -986,7 +986,7 @@
     /* Enable alpha blending by default if the new surface has an
      * alpha channel or alpha modulation */
     if ((surface->format->Amask && format->Amask) ||
-        (copy_flags & (SDL_COPY_COLORKEY|SDL_COPY_MODULATE_ALPHA))) {
+        (copy_flags & SDL_COPY_MODULATE_ALPHA)) {
         SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND);
     }
     if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) {


More information about the commits mailing list