[gimp/soc-2010-cage-2] GimpCageTool: add code in #if #else #endif to test the forward transform



commit c29396a0c23d9071b5f35d26b7bf2974d29e840a
Author: Michael Muré <batolettre gmail com>
Date:   Thu Aug 12 14:38:21 2010 +0200

    GimpCageTool: add code in #if #else #endif to test the forward transform

 app/tools/gimpcagetool.c |  107 +++++++++++++++++++++++++++++++---------------
 1 files changed, 72 insertions(+), 35 deletions(-)
---
diff --git a/app/tools/gimpcagetool.c b/app/tools/gimpcagetool.c
index bbaab2b..864c353 100644
--- a/app/tools/gimpcagetool.c
+++ b/app/tools/gimpcagetool.c
@@ -636,8 +636,8 @@ gimp_cage_tool_process (GimpCageTool *ct,
   {
     GeglNode *gegl = gegl_node_new ();
 
-/* debug coeficient */
 #if FALSE
+    /* debug coeficient */
     GeglNode *coef, *debug, *output;
 
     coef = gegl_node_new_child (gegl,
@@ -662,50 +662,87 @@ gimp_cage_tool_process (GimpCageTool *ct,
     gegl_node_connect_to (debug, "output",
                           output, "input");
 #else
-    GeglNode *coef, *cage, *render, *input, *output;
-
-    input  = gegl_node_new_child (gegl,
-                                  "operation",    "gimp:tilemanager-source",
-                                  "tile-manager", gimp_drawable_get_tiles (drawable),
-                                  "linear",       TRUE,
+    #if TRUE
+      /* reverse transform */
+      GeglNode *coef, *cage, *render, *input, *output;
+
+      input  = gegl_node_new_child (gegl,
+                                    "operation",    "gimp:tilemanager-source",
+                                    "tile-manager", gimp_drawable_get_tiles (drawable),
+                                    "linear",       TRUE,
+                                    NULL);
+
+      cage = gegl_node_new_child (gegl,
+                                  "operation", "gimp:cage_transform",
+                                  "config", ct->config,
+                                  NULL);
+      
+      coef = gegl_node_new_child (gegl,
+                                  "operation", "gegl:buffer-source",
+                                  "buffer",    ct->coef,
                                   NULL);
 
-    cage = gegl_node_new_child (gegl,
-                                "operation", "gimp:cage_transform",
-                                "config", ct->config,
-                                NULL);
-    
-    coef = gegl_node_new_child (gegl,
-                                "operation", "gegl:buffer-source",
-                                "buffer",    ct->coef,
-                                NULL);
+      render = gegl_node_new_child (gegl,
+                                    "operation", "gegl:render_mapping",
+                                    NULL);
 
-    render = gegl_node_new_child (gegl,
-                                  "operation", "gegl:render_mapping",
-                                  NULL);
+      new_tiles = gimp_drawable_get_shadow_tiles (drawable);
+      output = gegl_node_new_child (gegl,
+                                    "operation",    "gimp:tilemanager-sink",
+                                    "tile-manager", new_tiles,
+                                    "linear",       TRUE,
+                                    NULL);
 
-    new_tiles = gimp_drawable_get_shadow_tiles (drawable);
-    output = gegl_node_new_child (gegl,
-                                  "operation",    "gimp:tilemanager-sink",
-                                  "tile-manager", new_tiles,
-                                  "linear",       TRUE,
-                                  NULL);
+      gegl_node_connect_to (input, "output",
+                            cage, "input");
 
-    gegl_node_connect_to (input, "output",
-                          cage, "input");
+      gegl_node_connect_to (input, "output",
+                            render, "input");
 
-    gegl_node_connect_to (input, "output",
-                          render, "input");
+      gegl_node_connect_to (coef, "output",
+                            cage, "aux");
 
-    gegl_node_connect_to (coef, "output",
-                          cage, "aux");
+      gegl_node_connect_to (cage, "output",
+                            render, "aux");
 
-    gegl_node_connect_to (cage, "output",
-                          render, "aux");
+      gegl_node_connect_to (render, "output",
+                            output, "input");
+    #else
+      /* forward transform */
+      GeglNode *coef, *cage, *input, *output;
 
-    gegl_node_connect_to (render, "output",
-                          output, "input");
+      input  = gegl_node_new_child (gegl,
+                                    "operation",    "gimp:tilemanager-source",
+                                    "tile-manager", gimp_drawable_get_tiles (drawable),
+                                    "linear",       TRUE,
+                                    NULL);
+
+      cage = gegl_node_new_child (gegl,
+                                  "operation", "gimp:cage_preview",
+                                  "config", ct->config,
+                                  NULL);
+      
+      coef = gegl_node_new_child (gegl,
+                                  "operation", "gegl:buffer-source",
+                                  "buffer",    ct->coef,
+                                  NULL);
+
+      new_tiles = gimp_drawable_get_shadow_tiles (drawable);
+      output = gegl_node_new_child (gegl,
+                                    "operation",    "gimp:tilemanager-sink",
+                                    "tile-manager", new_tiles,
+                                    "linear",       TRUE,
+                                    NULL);
+
+      gegl_node_connect_to (input, "output",
+                            cage, "input");
+
+      gegl_node_connect_to (coef, "output",
+                            cage, "aux");
 
+      gegl_node_connect_to (cage, "output",
+                            output, "input");
+    #endif
 #endif
 
     /*gimp_drawable_apply_operation (drawable, progress, _("Cage transform"),



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