浏览代码

Speed up full-surface fills

Starbuck5 1 年之前
父节点
当前提交
7a3f5ef129
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/video/SDL_fillrect.c

+ 7 - 0
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; \
  \