Просмотр исходного кода

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

Fixes https://github.com/libsdl-org/SDL/issues/15297
Sam Lantinga 1 день назад
Родитель
Сommit
501ee05129
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      src/video/SDL_surface.c

+ 2 - 1
src/video/SDL_surface.c

@@ -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;