[gegl] operations: Use watch() to clean up the child nodes of meta ops



commit a3d785a4fe658314f70d93171eaadbd10c903ba4
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sun Feb 2 01:49:01 2014 -0800

    operations: Use watch() to clean up the child nodes of meta ops

 operations/common/difference-of-gaussians.c        |   61 +++++++-------------
 operations/common/dropshadow.c                     |    5 ++
 operations/common/high-pass.c                      |    2 +
 operations/common/layer.c                          |    8 +++
 operations/common/load.c                           |    2 +
 operations/common/rectangle.c                      |    3 +
 operations/common/unsharp-mask.c                   |    2 +
 operations/seamless-clone/seamless-clone-compose.c |    2 +
 operations/workshop/gaussian-blur-iir.c            |    2 +
 9 files changed, 47 insertions(+), 40 deletions(-)
---
diff --git a/operations/common/difference-of-gaussians.c b/operations/common/difference-of-gaussians.c
index 8642c2e..c81c3a1 100644
--- a/operations/common/difference-of-gaussians.c
+++ b/operations/common/difference-of-gaussians.c
@@ -36,56 +36,37 @@ gegl_chant_double_ui (radius2, _("Radius 2"),
 
 #include "gegl-chant.h"
 
-typedef struct _Priv Priv;
-struct _Priv
-{
-  GeglNode *self;
-  GeglNode *input;
-  GeglNode *output;
-
-  GeglNode *multiply;
-  GeglNode *subtract;
-  GeglNode *blur1;
-  GeglNode *blur2;
-};
-
 static void attach (GeglOperation *operation)
 {
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
-  Priv       *priv = g_new0 (Priv, 1);
-
-  o->chant_data = (void*) priv;
+  GeglNode *gegl = operation->node;
+  GeglNode *input, *output, *subtract, *blur1, *blur2;
 
-  if (!priv->blur1)
-    {
-      GeglNode      *gegl;
-      gegl = operation->node;
+  input    = gegl_node_get_input_proxy (gegl, "input");
+  output   = gegl_node_get_output_proxy (gegl, "output");
 
-      priv->input    = gegl_node_get_input_proxy (gegl, "input");
-      priv->output   = gegl_node_get_output_proxy (gegl, "output");
+  subtract = gegl_node_new_child (gegl,
+                                  "operation", "gegl:subtract",
+                                  NULL);
 
-      priv->subtract = gegl_node_new_child (gegl,
-                                            "operation", "gegl:subtract",
-                                            NULL);
+  blur1    = gegl_node_new_child (gegl,
+                                  "operation", "gegl:gaussian-blur",
+                                  NULL);
 
-      priv->blur1    = gegl_node_new_child (gegl,
-                                            "operation", "gegl:gaussian-blur",
-                                            NULL);
+  blur2    = gegl_node_new_child (gegl,
+                                  "operation", "gegl:gaussian-blur",
+                                  NULL);
 
-      priv->blur2    = gegl_node_new_child (gegl,
-                                            "operation", "gegl:gaussian-blur",
-                                            NULL);
+  gegl_node_link_many (input, blur1, subtract, output, NULL);
+  gegl_node_link (input, blur2);
 
-      gegl_node_link_many (priv->input, priv->blur1, priv->subtract, priv->output, NULL);
-      gegl_node_link (priv->input, priv->blur2);
+  gegl_node_connect_from (subtract, "aux", blur2, "output");
 
-      gegl_node_connect_from (priv->subtract, "aux",   priv->blur2,     "output");
+  gegl_operation_meta_redirect (operation, "radius1", blur1, "std-dev-x");
+  gegl_operation_meta_redirect (operation, "radius1", blur1, "std-dev-y");
+  gegl_operation_meta_redirect (operation, "radius2", blur2, "std-dev-x");
+  gegl_operation_meta_redirect (operation, "radius2", blur2, "std-dev-y");
 
-      gegl_operation_meta_redirect (operation, "radius1", priv->blur1, "std-dev-x");
-      gegl_operation_meta_redirect (operation, "radius1", priv->blur1, "std-dev-y");
-      gegl_operation_meta_redirect (operation, "radius2", priv->blur2, "std-dev-x");
-      gegl_operation_meta_redirect (operation, "radius2", priv->blur2, "std-dev-y");
-    }
+  gegl_operation_meta_watch_nodes (operation, subtract, blur1, blur2, NULL);
 }
 
 static void
diff --git a/operations/common/dropshadow.c b/operations/common/dropshadow.c
index 7950823..0383535 100644
--- a/operations/common/dropshadow.c
+++ b/operations/common/dropshadow.c
@@ -83,6 +83,11 @@ attach (GeglOperation *operation)
   gegl_operation_meta_redirect (operation, "y", translate, "y");
   gegl_operation_meta_redirect (operation, "color", color, "value");
   gegl_operation_meta_redirect (operation, "opacity", opacity, "value");
+
+  gegl_operation_meta_watch_nodes (operation,
+                                   over, translate, opacity,
+                                   blur, darken, color,
+                                   NULL);
 }
 
 static void
diff --git a/operations/common/high-pass.c b/operations/common/high-pass.c
index 63981a4..a556be3 100644
--- a/operations/common/high-pass.c
+++ b/operations/common/high-pass.c
@@ -56,6 +56,8 @@ attach (GeglOperation *operation)
   gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-x");
   gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-y");
   gegl_operation_meta_redirect (operation, "contrast", contrast, "contrast");
+
+  gegl_operation_meta_watch_nodes (operation, invert, blur, opacity, over, contrast, NULL);
 }
 
 static void
diff --git a/operations/common/layer.c b/operations/common/layer.c
index 0b656b5..76cc52b 100644
--- a/operations/common/layer.c
+++ b/operations/common/layer.c
@@ -216,6 +216,14 @@ static void attach (GeglOperation *operation)
   gegl_node_link_many (self->input, self->composite_op, self->output, NULL);
   gegl_node_connect_from (self->composite_op, "aux", self->translate, "output");
 
+  gegl_operation_meta_watch_nodes (operation,
+                                   self->composite_op,
+                                   self->translate,
+                                   self->scale,
+                                   self->opacity,
+                                   self->load,
+                                   NULL);
+
   do_setup (operation);
 }
 
diff --git a/operations/common/load.c b/operations/common/load.c
index 149385a..1d1c360 100644
--- a/operations/common/load.c
+++ b/operations/common/load.c
@@ -108,6 +108,8 @@ static void attach (GeglOperation *operation)
   do_setup (operation, o->path);
 
   gegl_node_link (self->load, self->output);
+
+  gegl_operation_meta_watch_node (operation, self->load);
 }
 
 static GeglNode *
diff --git a/operations/common/rectangle.c b/operations/common/rectangle.c
index 0a0bf65..6022e46 100644
--- a/operations/common/rectangle.c
+++ b/operations/common/rectangle.c
@@ -53,6 +53,9 @@ static void attach (GeglOperation *operation)
   color = gegl_node_new_child (gegl, "operation", "gegl:color", NULL);
   crop  = gegl_node_new_child (gegl, "operation", "gegl:crop", NULL);
 
+  gegl_operation_meta_watch_node (operation, color);
+  gegl_operation_meta_watch_node (operation, crop);
+
   gegl_node_link_many (color, crop, output, NULL);
 
   gegl_operation_meta_redirect (operation, "color", color, "value");
diff --git a/operations/common/unsharp-mask.c b/operations/common/unsharp-mask.c
index d1d105d..e026fb4 100644
--- a/operations/common/unsharp-mask.c
+++ b/operations/common/unsharp-mask.c
@@ -60,6 +60,8 @@ attach (GeglOperation *operation)
   gegl_operation_meta_redirect (operation, "scale", multiply, "value");
   gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-x");
   gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-y");
+
+  gegl_operation_meta_watch_nodes (operation, add, multiply, subtract, blur, NULL);
 }
 
 static void
diff --git a/operations/seamless-clone/seamless-clone-compose.c 
b/operations/seamless-clone/seamless-clone-compose.c
index 3b767af..297856e 100644
--- a/operations/seamless-clone/seamless-clone-compose.c
+++ b/operations/seamless-clone/seamless-clone-compose.c
@@ -76,6 +76,8 @@ attach (GeglOperation *operation)
   gegl_operation_meta_redirect (operation, "xoff", seamless, "xoff");
   gegl_operation_meta_redirect (operation, "yoff", seamless, "yoff");
   gegl_operation_meta_redirect (operation, "error-msg", seamless, "error-msg");
+
+  gegl_operation_meta_watch_nodes (operation, seamless, overlay, NULL);
 }
 
 static void
diff --git a/operations/workshop/gaussian-blur-iir.c b/operations/workshop/gaussian-blur-iir.c
index 0de8dab..d7200cc 100644
--- a/operations/workshop/gaussian-blur-iir.c
+++ b/operations/workshop/gaussian-blur-iir.c
@@ -87,6 +87,8 @@ attach (GeglOperation *operation)
   gegl_operation_meta_redirect (operation, "abyss-policy", vblur, "abyss-policy");
   gegl_operation_meta_redirect (operation, "filter",       vblur, "filter");
   gegl_operation_meta_redirect (operation, "clip-extent",  vblur, "clip-extent");
+
+  gegl_operation_meta_watch_nodes (operation, hblur, vblur, NULL);
 }
 
 static void


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