Only set colorkey, if converted surface has no alpha channel (2979)
authorSylvain Becker <sylvain.becker@gmail.com>
Sun, 17 May 2020 21:23:17 +0200
changeset 13813c0689749d4b4
parent 13812 5c4ad9fc7b21
child 13814 dc7142e7b47e
Only set colorkey, if converted surface has no alpha channel (2979)
src/video/SDL_surface.c
     1.1 --- a/src/video/SDL_surface.c	Sun May 17 20:45:55 2020 +0200
     1.2 +++ b/src/video/SDL_surface.c	Sun May 17 21:23:17 2020 +0200
     1.3 @@ -1116,9 +1116,13 @@
     1.4                  /* The palette is identical, just set the same colorkey */
     1.5                  SDL_SetColorKey(convert, 1, surface->map->info.colorkey);
     1.6              } else if (!format->palette) {
     1.7 -                set_colorkey_by_color = SDL_TRUE;
     1.8 -                /* Was done by 'palette_ck_transform' */
     1.9 -                convert_colorkey = SDL_FALSE;
    1.10 +                if (format->Amask) {
    1.11 +                    /* No need to add the colorkey, transparency is in the alpha channel*/
    1.12 +                } else {
    1.13 +                    /* Only set the colorkey information */
    1.14 +                    set_colorkey_by_color = SDL_TRUE;
    1.15 +                    convert_colorkey = SDL_FALSE;
    1.16 +                }
    1.17              } else {
    1.18                  set_colorkey_by_color = SDL_TRUE;
    1.19              }