This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository expedite.

View the commit online.

commit 337f19de74176d51e8d5d45f81b71e8d3e61fe0d
Author: [email protected] <[email protected]>
AuthorDate: Sun Mar 29 17:07:14 2026 -0600

    test: add VG composite/mask benchmark (rainbow batman)
    
    Add expedite test "VG Basic Composite" that exercises the VG container
    composite feature using MATTE_ALPHA. A gradient-filled rectangle in a
    source container is masked by the Batman path in a target container.
    
    Correct rendering shows rainbow-colored batman silhouettes bouncing
    around the screen. Without compositing the full gradient rectangles
    would be visible (mask ignored).
    
    This test currently passes under ECTOR_BACKEND=software (46 FPS) but
    crashes under the GL span-buffer path, exposing that composite support
    is not yet implemented in the span-buffer pipeline.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
 src/bin/meson.build          |   1 +
 src/bin/tests.h              |   1 +
 src/bin/vg_basic_composite.c | 165 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 167 insertions(+)

diff --git a/src/bin/meson.build b/src/bin/meson.build
index 0d7fb31..78c2882 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -125,6 +125,7 @@ expedite_sources = [ 'main.c',
 	'vg_basic_radial_gradient.c',
 	'vg_basic_batman.c',
 	'vg_basic_network.c',
+	'vg_basic_composite.c',
 	'vg_scaled.c',
 	'snapshot_widgets_file_icons.c' ]
 
diff --git a/src/bin/tests.h b/src/bin/tests.h
index a85c1be..bc6c564 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -118,6 +118,7 @@
 #include "vg_basic_radial_gradient.c"
 #include "vg_basic_batman.c"
 #include "vg_basic_network.c"
+#include "vg_basic_composite.c"
 #include "vg_scaled.c"
 #include "snapshot_widgets_file_icons.c"
 #if 0 // test disabled - evas having code disabled
diff --git a/src/bin/vg_basic_composite.c b/src/bin/vg_basic_composite.c
new file mode 100644
index 0000000..86515f2
--- /dev/null
+++ b/src/bin/vg_basic_composite.c
@@ -0,0 +1,165 @@
+#undef FNAME
+#undef NAME
+#undef ICON
+
+/* metadata */
+#define FNAME vg_basic_composite_start
+#define NAME "VG Basic Composite"
+#define ICON "vector.png"
+
+#ifndef PROTO
+# ifndef UI
+#  include "main.h"
+
+/* standard var */
+static int done = 0;
+
+/* private data */
+static Eo *o_shapes[OBNUM];
+
+/* Batman SVG path, pre-scaled to fit in ~80x70.
+ * Reused from vg_basic_batman.c.
+ * The mask container holds this shape filled with solid white (alpha=255).
+ * Correct rendering: rainbow gradient visible only inside the batman silhouette.
+ * Broken rendering (composite ignored): full rectangle showing gradient. */
+static const char *batman_path =
+   "M 28.5,51.3 C 25.6,42.9 15.4,44.5 22.7,64.2"
+   " 0.0,42.9 5.8,14.0 22.5,0.0"
+   " 19.1,10.0 23.0,16.6 35.6,18.4"
+   " 36.1,16.0 36.3,13.5 36.9,11.1"
+   " 37.1,11.4 37.4,11.8 37.6,12.1"
+   " 37.6,12.1 39.2,11.8 40.0,11.8"
+   " 40.8,11.8 42.4,12.1 42.4,12.1"
+   " 42.6,11.8 42.9,11.4 43.1,11.1"
+   " 43.7,13.5 43.9,16.0 44.4,18.4"
+   " 57.0,16.8 60.9,10.0 57.5,0.0"
+   " 74.2,13.9 80.0,42.9 57.3,64.2"
+   " 64.6,44.5 54.6,42.9 51.5,51.3"
+   " 47.3,43.9 42.4,43.7 40.0,70.0"
+   " 37.6,43.7 32.7,43.9 28.5,51.3 Z";
+
+/* Rainbow gradient stops: red -> yellow -> green -> cyan -> blue.
+ * Pre-multiplied alpha: r/g/b values are already at full alpha so
+ * no scaling needed.  The gradient spans the full VG object width
+ * so every hue is visible across the batman silhouette. */
+static const Efl_Gfx_Gradient_Stop rainbow_stops[5] = {
+   { 0.00, 255,   0,   0, 255 },
+   { 0.25, 255, 255,   0, 255 },
+   { 0.50,   0, 255,   0, 255 },
+   { 0.75,   0, 255, 255, 255 },
+   { 1.00,   0,   0, 255, 255 },
+};
+
+/* VG object dimensions: batman path fits in 80x70, add 2px stroke margin. */
+#define VG_W 84
+#define VG_H 74
+#define STROKE_M 2
+
+/* setup */
+static void _setup(void)
+{
+   unsigned int i;
+
+   for (i = 0; i < OBNUM; i++)
+     {
+        Eo *vector;
+        Efl_VG *root, *source_container, *mask_container;
+        Efl_VG *grad, *rect_shape, *batman_shape;
+
+        vector = efl_add(EFL_CANVAS_VG_OBJECT_CLASS, evas);
+        o_shapes[i] = vector;
+        efl_gfx_entity_size_set(vector, EINA_SIZE2D(VG_W, VG_H));
+        efl_gfx_entity_position_set(vector, EINA_POSITION2D(0, 0));
+        efl_gfx_entity_visible_set(vector, EINA_TRUE);
+
+        root = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, vector);
+
+        /* Source container: gradient-filled rectangle.
+         * Its content is visible only where the mask container has alpha > 0. */
+        source_container = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, root);
+
+        grad = efl_add(EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS, source_container);
+        efl_gfx_gradient_linear_start_set(grad, 0, 0);
+        efl_gfx_gradient_linear_end_set(grad, VG_W, VG_H);
+        efl_gfx_gradient_stop_set(grad, rainbow_stops, 5);
+
+        rect_shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, source_container);
+        efl_gfx_path_append_rect(rect_shape, 0, 0, VG_W, VG_H, 0, 0);
+        efl_canvas_vg_shape_fill_set(rect_shape, grad);
+
+        /* Mask container: batman shape filled solid white (alpha=255).
+         * MATTE_ALPHA uses this container's alpha channel as a stencil. */
+        mask_container = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, root);
+
+        batman_shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, mask_container);
+        efl_canvas_vg_node_origin_set(batman_shape, STROKE_M, STROKE_M);
+        efl_gfx_path_append_svg_path(batman_shape, batman_path);
+        efl_gfx_color_set(batman_shape, 255, 255, 255, 255);
+
+        /* Apply MATTE_ALPHA: source_container is composited using
+         * mask_container as the alpha matte.  Where mask alpha == 255
+         * (inside batman) the source is fully visible; outside it
+         * disappears.  If compositing is broken, the full gradient
+         * rectangle is rendered instead. */
+        efl_canvas_vg_node_comp_method_set(source_container, mask_container,
+                                            EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA);
+
+        efl_canvas_vg_object_root_node_set(vector, root);
+     }
+   done = 0;
+}
+
+/* cleanup */
+static void _cleanup(void)
+{
+   unsigned int i;
+
+   for (i = 0; i < OBNUM; i++) efl_del(o_shapes[i]);
+}
+
+/* loop - do things */
+static void _loop(double t, int f)
+{
+   int i;
+   Evas_Coord x, y, w = 200, h = 200;
+
+   for (i = 0; i < OBNUM; i++)
+     {
+        x = (win_w / 2) - (w / 2);
+        x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
+        y = (win_h / 2) - (h / 2);
+        y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (w / 2);
+        efl_gfx_entity_position_set(o_shapes[i], EINA_POSITION2D(x, y));
+     }
+   FPS_STD(NAME);
+}
+
+/* prepend special key handlers if interactive (before STD) */
+static void _key(const char *key)
+{
+   KEY_STD;
+}
+
+/* template stuff - ignore */
+# endif
+#endif
+
+#ifdef UI
+_ui_menu_item_add(ICON, NAME, FNAME);
+#endif
+
+#ifdef PROTO
+void FNAME(void);
+#endif
+
+#ifndef PROTO
+# ifndef UI
+void FNAME(void)
+{
+   ui_func_set(_key, _loop, _setup);
+}
+# endif
+#endif
+#undef FNAME
+#undef NAME
+#undef ICON

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to