SDL: Enable RLE more often in the software renderer

From cc2a272d6faf89eece76970d5682ea3e0b656b0a Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 8 Nov 2025 13:54:28 -0800
Subject: [PATCH] Enable RLE more often in the software renderer

We don't need to aggressively disable RLE acceleration anymore because the original pixels remain available for operations that aren't supported by the RLE blitter.
---
 src/render/software/SDL_render_sw.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c
index ea848ba68cf5d..484a6b3984d1c 100644
--- a/src/render/software/SDL_render_sw.c
+++ b/src/render/software/SDL_render_sw.c
@@ -154,10 +154,7 @@ static bool SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
         }
     }
 
-    /* Only RLE encode textures without an alpha channel since the RLE coder
-     * discards the color values of pixels with an alpha value of zero.
-     */
-    if (texture->access == SDL_TEXTUREACCESS_STATIC && !SDL_ISPIXELFORMAT_ALPHA(surface->format)) {
+    if (texture->access == SDL_TEXTUREACCESS_STATIC) {
         SDL_SetSurfaceRLE(surface, true);
     }
 
@@ -674,13 +671,6 @@ static void PrepTextureForCopy(const SDL_RenderCommand *cmd, SW_DrawStateCache *
     const SDL_BlendMode blend = cmd->data.draw.blend;
     SDL_Texture *texture = cmd->data.draw.texture;
     SDL_Surface *surface = (SDL_Surface *)texture->internal;
-    const bool colormod = ((r & g & b) != 0xFF);
-    const bool alphamod = (a != 0xFF);
-    const bool blending = ((blend == SDL_BLENDMODE_ADD) || (blend == SDL_BLENDMODE_MOD) || (blend == SDL_BLENDMODE_MUL));
-
-    if (colormod || alphamod || blending) {
-        SDL_SetSurfaceRLE(surface, false);
-    }
 
     // !!! FIXME: we can probably avoid some of these calls.
     SDL_SetSurfaceColorMod(surface, r, g, b);
@@ -876,11 +866,6 @@ static bool SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
             if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
                 SDL_BlitSurface(src, srcrect, surface, dstrect);
             } else {
-                /* If scaling is ever done, permanently disable RLE (which doesn't support scaling)
-                 * to avoid potentially frequent RLE encoding/decoding.
-                 */
-                SDL_SetSurfaceRLE(surface, false);
-
                 // 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);