SDL: Optimize BlitRGBtoRGBSurfaceAlpha

From d37f8fa2b3ad865b23bc6c15f2d11c6bce70b4cd Mon Sep 17 00:00:00 2001
From: Brick <[EMAIL REDACTED]>
Date: Mon, 8 Jul 2024 20:21:48 +0100
Subject: [PATCH] Optimize BlitRGBtoRGBSurfaceAlpha

---
 src/video/SDL_blit_A.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c
index 51f1076547e87..d8d6d80c7f9d5 100644
--- a/src/video/SDL_blit_A.c
+++ b/src/video/SDL_blit_A.c
@@ -364,18 +364,10 @@ static void BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo *info)
             DUFFS_LOOP4({
                 s = *srcp;
                 d = *dstp;
-                Uint8 sR = (s >> 16) & 0xFF;
-                Uint8 sG = (s >> 8) & 0xFF;
-                Uint8 sB = s & 0xFF;
-                Uint8 dR = (d >> 16) & 0xFF;
-                Uint8 dG = (d >> 8) & 0xFF;
-                Uint8 dB = d & 0xFF;
-
-                ALPHA_BLEND_CHANNEL(sR, dR, alpha);
-                ALPHA_BLEND_CHANNEL(sG, dG, alpha);
-                ALPHA_BLEND_CHANNEL(sB, dB, alpha);
-
-                *dstp = (dR << 16) | (dG << 8) | dB | 0xFF000000;
+
+                FACTOR_BLEND_8888(s, d, alpha);
+
+                *dstp = d | 0xff000000;
                 ++srcp;
                 ++dstp;
             }, width);