Skip to content

Commit

Permalink
Converted surfaces with alpha format default to SDL_BLENDMODE_BLEND
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 17, 2024
1 parent f22eedc commit bf0ad88
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/video/SDL_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,6 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
int ret;
SDL_bool palette_ck_transform = SDL_FALSE;
Uint8 palette_ck_value = 0;
SDL_bool palette_has_alpha = SDL_FALSE;
Uint8 *palette_saved_alpha = NULL;
int palette_saved_alpha_ncolors = 0;

Expand Down Expand Up @@ -1447,8 +1446,6 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
if (!has_alpha_channel) {
set_opaque = SDL_TRUE;
}
} else {
palette_has_alpha = SDL_TRUE;
}

/* Set opaque and backup palette alpha values */
Expand All @@ -1469,7 +1466,6 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
if (copy_flags & SDL_COPY_COLORKEY) {
if (surface->internal->palette && !palette) {
palette_ck_transform = SDL_TRUE;
palette_has_alpha = SDL_TRUE;
palette_ck_value = surface->internal->palette->colors[surface->internal->map.info.colorkey].a;
surface->internal->palette->colors[surface->internal->map.info.colorkey].a = SDL_ALPHA_TRANSPARENT;
}
Expand Down Expand Up @@ -1590,8 +1586,7 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm

/* Enable alpha blending by default if the new surface has an
* alpha channel or alpha modulation */
if ((SDL_ISPIXELFORMAT_ALPHA(surface->format) && SDL_ISPIXELFORMAT_ALPHA(format)) ||
(palette_has_alpha && SDL_ISPIXELFORMAT_ALPHA(format)) ||
if (SDL_ISPIXELFORMAT_ALPHA(format) ||
(copy_flags & SDL_COPY_MODULATE_ALPHA)) {
SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND);
}
Expand Down

0 comments on commit bf0ad88

Please sign in to comment.