Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only set colorkey, if converted surface has no alpha channel (2979)
  • Loading branch information
1bsyl committed May 17, 2020
1 parent f6197ae commit db4246f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/video/SDL_surface.c
Expand Up @@ -1116,9 +1116,13 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
/* The palette is identical, just set the same colorkey */
SDL_SetColorKey(convert, 1, surface->map->info.colorkey);
} else if (!format->palette) {
set_colorkey_by_color = SDL_TRUE;
/* Was done by 'palette_ck_transform' */
convert_colorkey = SDL_FALSE;
if (format->Amask) {
/* No need to add the colorkey, transparency is in the alpha channel*/
} else {
/* Only set the colorkey information */
set_colorkey_by_color = SDL_TRUE;
convert_colorkey = SDL_FALSE;
}
} else {
set_colorkey_by_color = SDL_TRUE;
}
Expand Down

0 comments on commit db4246f

Please sign in to comment.