From 95c12e388ff131ecc3908b1b9a8f584a80faac77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= <pippin@gimp.org>
Date: Sat, 12 Aug 2023 11:47:35 +0200
Subject: [PATCH] ctx: tune fast path settings

---
 components/ctx/ctx.h | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/components/ctx/ctx.h b/components/ctx/ctx.h
index 40752558d7..c50a6032ce 100644
--- a/components/ctx/ctx.h
+++ b/components/ctx/ctx.h
@@ -1,4 +1,4 @@
-/* ctx git commit: e460cf76 */
+/* ctx git commit: 4349079e */
 /* 
  * ctx.h is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -5007,6 +5007,10 @@ static inline CtxList *ctx_list_find_custom (CtxList *list,
                                     a ~15-20% performance win can be seen. */
 #endif
 
+#ifndef CTX_FAST_STROKE_RECT
+#define CTX_FAST_STROKE_RECT 0 
+#endif
+
 
 #ifndef CTX_COMPOSITING_GROUPS
 #define CTX_COMPOSITING_GROUPS   1
@@ -5775,7 +5779,7 @@ static inline CtxList *ctx_list_find_custom (CtxList *list,
 #endif
 
 #ifndef CTX_STROKE_1PX   
-#define CTX_STROKE_1PX    1
+#define CTX_STROKE_1PX    0
 #endif
 
  /* Copyright (C) 2020 Ƙyvind Kol�s <pippin@gimp.org>
@@ -18733,6 +18737,8 @@ CTX_SIMD_SUFFIX (ctx_composite_fill_rect) (CtxRasterizer *rasterizer,
   }
 }
 
+#endif
+#if CTX_FAST_STROKE_RECT
 void
 CTX_SIMD_SUFFIX(ctx_composite_stroke_rect) (CtxRasterizer *rasterizer,
                            float          x0,
@@ -18837,9 +18843,9 @@ CTX_SIMD_SUFFIX(ctx_composite_stroke_rect) (CtxRasterizer *rasterizer,
                                  x0+hw, y1+hw, 255);
       }
 }
+#endif
 
 
-#endif
 
 static void
 CTX_SIMD_SUFFIX (ctx_composite_setup) (CtxRasterizer *rasterizer)
@@ -20823,6 +20829,8 @@ void CTX_SIMD_SUFFIX(ctx_simd_setup)(void)
   ctx_rasterizer_rasterize_edges = CTX_SIMD_SUFFIX(ctx_rasterizer_rasterize_edges);
 #if CTX_FAST_FILL_RECT
   ctx_composite_fill_rect   = CTX_SIMD_SUFFIX(ctx_composite_fill_rect);
+#endif
+#if CTX_FAST_STROKE_RECT
   ctx_composite_stroke_rect = CTX_SIMD_SUFFIX(ctx_composite_stroke_rect);
 #endif
 }
@@ -22200,7 +22208,7 @@ ctx_rasterizer_stroke (CtxRasterizer *rasterizer)
 
   CtxSegment temp[count]; /* copy of already built up path's poly line  */
   memcpy (temp, rasterizer->edge_list.entries, sizeof (temp) );
-
+#if 0
 #if CTX_FAST_FILL_RECT
   if (rasterizer->edge_list.count == 5)
     {
@@ -22229,6 +22237,7 @@ ctx_rasterizer_stroke (CtxRasterizer *rasterizer)
         goto done;
        }
     }
+#endif
 #endif
   
     {
@@ -22449,7 +22458,7 @@ foo:
     }
   }
 #if CTX_FAST_FILL_RECT
-done:
+//done:
 #endif
   if (preserved)
     {
@@ -55904,7 +55913,7 @@ void (*ctx_rasterizer_rasterize_edges) (CtxRasterizer *rasterizer, const int fil
 
 void (*ctx_composite_setup) (CtxRasterizer *rasterizer) =
       ctx_composite_setup_generic;
-#if CTX_FAST_FILL_RECT
+#if CTX_FAST_STROKE_RECT
 void (*ctx_composite_stroke_rect) (CtxRasterizer *rasterizer,
                            float          x0,
                            float          y0,
@@ -55912,7 +55921,9 @@ void (*ctx_composite_stroke_rect) (CtxRasterizer *rasterizer,
                            float          y1,
                            float          line_width) =
       ctx_composite_stroke_rect_generic;
+#endif
 
+#if CTX_FAST_FILL_RECT
 void (*ctx_composite_fill_rect) (CtxRasterizer *rasterizer,
                            float        x0,
                            float        y0,
-- 
GitLab