From fcce05a19ccbc568f0b3f17a82db6daf25a05c74 Mon Sep 17 00:00:00 2001
From: MSRPP-dev <[EMAIL REDACTED]>
Date: Mon, 2 Mar 2026 17:37:35 +0100
Subject: [PATCH] Update SDL_render_sw.c
Fix the bug in the standard scaling path, SDL_RENDERCMD_COPY should follow the same pattern as SW_RenderCopyEx.
(cherry picked from commit 4dbf5811e9d515d0f0e8cc8faeb528014923339c)
---
src/render/software/SDL_render_sw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c
index 0c4d8401cc032..160e2a10beeb2 100644
--- a/src/render/software/SDL_render_sw.c
+++ b/src/render/software/SDL_render_sw.c
@@ -868,7 +868,8 @@ static bool SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
} else {
// Prevent to do scaling + clipping on viewport boundaries as it may lose proportion
if (dstrect->x < 0 || dstrect->y < 0 || dstrect->x + dstrect->w > surface->w || dstrect->y + dstrect->h > surface->h) {
- SDL_Surface *tmp = SDL_CreateSurface(dstrect->w, dstrect->h, surface->format);
+ SDL_PixelFormat tmp_format = SDL_ISPIXELFORMAT_ALPHA(src->format) ? SDL_PIXELFORMAT_ARGB8888 : surface->format;
+ SDL_Surface *tmp = SDL_CreateSurface(dstrect->w, dstrect->h, tmp_format);
// Scale to an intermediate surface, then blit
if (tmp) {
SDL_Rect r;