From 7a3f5ef129d7650f9b1a9077e304a15816323976 Mon Sep 17 00:00:00 2001 From: Starbuck5 <46412508+Starbuck5@users.noreply.github.com> Date: Sat, 23 Nov 2024 14:48:52 -0800 Subject: [PATCH] Speed up full-surface fills --- 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 f8879e9930..f8b0ce2b31 100644 --- a/src/video/SDL_fillrect.c +++ b/src/video/SDL_fillrect.c @@ -59,6 +59,13 @@ static void SDL_TARGETING("sse") SDL_FillSurfaceRect##bpp##SSE(Uint8 *pixels, in { \ 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; \ \