Don't strip the alpha channel when scaling surfaces if it will be needed

Fixes https://github.com/libsdl-org/SDL/issues/15297

(cherry picked from commit 501ee05129)
This commit is contained in:
Sam Lantinga
2026-04-02 11:00:17 -07:00
parent 9c6876ac18
commit 870c006288

View File

@@ -1314,7 +1314,8 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
// Change source format if not appropriate for scaling
if (SDL_BYTESPERPIXEL(src->format) != 4 || src->format == SDL_PIXELFORMAT_ARGB2101010) {
SDL_PixelFormat fmt;
if (SDL_BYTESPERPIXEL(dst->format) == 4 && dst->format != SDL_PIXELFORMAT_ARGB2101010) {
if (SDL_BYTESPERPIXEL(dst->format) == 4 && dst->format != SDL_PIXELFORMAT_ARGB2101010 &&
(SDL_ISPIXELFORMAT_ALPHA(dst->format) || !is_complex_copy_flags)) {
fmt = dst->format;
} else {
fmt = SDL_PIXELFORMAT_ARGB8888;