[gegl] recursive-transform-plus: fix gegl:over node count; reverse disconnection



commit 52a5da6526e89c7b7167dce9db2060bb7287b65e
Author: Ell <ell_se yahoo com>
Date:   Tue Jun 5 11:14:45 2018 -0400

    recursive-transform-plus: fix gegl:over node count; reverse disconnection
    
    Fix the number of gegl:over nodes per iteration.  There was
    accidentally one less than necessary, breaking the op when using
    the maximal number of transformations.
    
    Reverse the order in which nodes are disconnected when updating the
    graph, to reduce the number of invalidations.

 operations/workshop/recursive-transform-plus.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/operations/workshop/recursive-transform-plus.c b/operations/workshop/recursive-transform-plus.c
index 9426d09d8..dbc2ab97f 100644
--- a/operations/workshop/recursive-transform-plus.c
+++ b/operations/workshop/recursive-transform-plus.c
@@ -67,7 +67,7 @@ typedef struct
   GeglNode *transform_nodes[MAX_TRANSFORMS];
   GeglNode *color_overlay_node;
   GeglNode *opacity_node;
-  GeglNode *over_nodes[MAX_TRANSFORMS - 1];
+  GeglNode *over_nodes[MAX_TRANSFORMS];
 } Iteration;
 
 static void
@@ -93,17 +93,17 @@ update_graph (GeglOperation *operation)
 
   for (i = 0; i <= MAX_ITERATIONS; i++)
     {
-      for (j = 0; j < MAX_TRANSFORMS; j++)
-        gegl_node_disconnect (iters[i].transform_nodes[j], "input");
-
-      gegl_node_disconnect (iters[i].color_overlay_node,   "input");
-      gegl_node_disconnect (iters[i].opacity_node,         "input");
-
-      for (j = 0; j < MAX_TRANSFORMS - 1; j++)
+      for (j = MAX_TRANSFORMS - 1; j >= 0; j--)
         {
           gegl_node_disconnect (iters[i].over_nodes[j],    "input");
           gegl_node_disconnect (iters[i].over_nodes[j],    "aux");
         }
+
+      gegl_node_disconnect (iters[i].opacity_node,         "input");
+      gegl_node_disconnect (iters[i].color_overlay_node,   "input");
+
+      for (j = 0; j < MAX_TRANSFORMS; j++)
+        gegl_node_disconnect (iters[i].transform_nodes[j], "input");
     }
 
   if (o->first_iteration == 0 && o->iterations == 0)
@@ -332,7 +332,7 @@ attach (GeglOperation *operation)
                                        iters[i].opacity_node,
                                        NULL);
 
-      for (j = 0; j < MAX_TRANSFORMS - 1; j++)
+      for (j = 0; j < MAX_TRANSFORMS; j++)
         {
           iters[i].over_nodes[j] =
             gegl_node_new_child (node,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]