From 1e3465dc998cbba7adeadd38030d5e38d189389e Mon Sep 17 00:00:00 2001
From: Starbuck5 <[EMAIL REDACTED]>
Date: Sat, 23 Nov 2024 14:48:52 -0800
Subject: [PATCH] Speed up full-surface fills
(cherry picked from commit 7a3f5ef129d7650f9b1a9077e304a15816323976)
(cherry picked from commit 9f07ac8bba58dd3ee000fee68e6219953393c460)
---
src/video/SDL_fillrect.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c
index d7d112fd1419d..c7d8acd05d40e 100644
--- a/src/video/SDL_fillrect.c
+++ b/src/video/SDL_fillrect.c
@@ -61,6 +61,13 @@ static void SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w
{ \
int i, n; \
Uint8 *p = NULL; \
+ \
+ /* If the number of bytes per row is equal to the pitch, treat */ \
+ /* all rows as one long continuous row (for better performance) */ \
+ if ((w) * (bpp) == pitch) { \
+ w = w * h; \
+ h = 1; \
+ } \
\
SSE_BEGIN; \
\