gimp r27217 - in trunk: . app/core



Author: mitch
Date: Fri Oct 10 21:53:34 2008
New Revision: 27217
URL: http://svn.gnome.org/viewvc/gimp?rev=27217&view=rev

Log:
2008-10-10  Michael Natterer  <mitch gimp org>

	* app/core/gimpdrawablestack.c
	(gimp_drawable_stack_add_node)
	(gimp_drawable_stack_remove_node): simplify by getting rid of code
	duplication.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpdrawablestack.c

Modified: trunk/app/core/gimpdrawablestack.c
==============================================================================
--- trunk/app/core/gimpdrawablestack.c	(original)
+++ trunk/app/core/gimpdrawablestack.c	Fri Oct 10 21:53:34 2008
@@ -198,6 +198,7 @@
                               GimpDrawable      *drawable)
 {
   GimpDrawable *drawable_below;
+  GeglNode     *node_above;
   GeglNode     *node;
   gint          index;
 
@@ -208,27 +209,21 @@
 
   if (index == 0)
     {
-      GeglNode *output;
-
-      output = gegl_node_get_output_proxy (stack->graph, "output");
-
-      gegl_node_connect_to (node,   "output",
-                            output, "input");
+      node_above = gegl_node_get_output_proxy (stack->graph, "output");
     }
   else
     {
       GimpDrawable *drawable_above;
-      GeglNode     *node_above;
 
       drawable_above = (GimpDrawable *)
         gimp_container_get_child_by_index (GIMP_CONTAINER (stack), index - 1);
 
       node_above = gimp_drawable_get_node (drawable_above);
-
-      gegl_node_connect_to (node,       "output",
-                            node_above, "input");
     }
 
+  gegl_node_connect_to (node,       "output",
+                        node_above, "input");
+
   drawable_below = (GimpDrawable *)
     gimp_container_get_child_by_index (GIMP_CONTAINER (stack), index + 1);
 
@@ -246,6 +241,7 @@
                                  GimpDrawable      *drawable)
 {
   GimpDrawable *drawable_below;
+  GeglNode     *node_above;
   GeglNode     *node;
   gint          index;
 
@@ -258,48 +254,33 @@
   index = gimp_container_get_child_index (GIMP_CONTAINER (stack),
                                           GIMP_OBJECT (drawable));
 
-  drawable_below = (GimpDrawable *)
-    gimp_container_get_child_by_index (GIMP_CONTAINER (stack), index + 1);
-
   if (index == 0)
     {
-      if (drawable_below)
-        {
-          GeglNode *node_below;
-          GeglNode *output;
-
-          node_below = gimp_drawable_get_node (drawable_below);
-
-          output = gegl_node_get_output_proxy (stack->graph, "output");
-
-          gegl_node_disconnect (node,       "input");
-          gegl_node_connect_to (node_below, "output",
-                                output,     "input");
-        }
+      node_above = gegl_node_get_output_proxy (stack->graph, "output");
     }
   else
     {
       GimpDrawable *drawable_above;
-      GeglNode     *node_above;
 
       drawable_above = (GimpDrawable *)
         gimp_container_get_child_by_index (GIMP_CONTAINER (stack), index - 1);
 
       node_above = gimp_drawable_get_node (drawable_above);
+    }
 
-      if (drawable_below)
-        {
-          GeglNode *node_below;
-
-          node_below = gimp_drawable_get_node (drawable_below);
-
-          gegl_node_disconnect (node,       "input");
-          gegl_node_connect_to (node_below, "output",
-                                node_above, "input");
-        }
-      else
-        {
-          gegl_node_disconnect (node_above, "input");
-        }
+  drawable_below = (GimpDrawable *)
+    gimp_container_get_child_by_index (GIMP_CONTAINER (stack), index + 1);
+
+  if (drawable_below)
+    {
+      GeglNode *node_below = gimp_drawable_get_node (drawable_below);
+
+      gegl_node_disconnect (node,       "input");
+      gegl_node_connect_to (node_below, "output",
+                            node_above, "input");
+    }
+  else
+    {
+      gegl_node_disconnect (node_above, "input");
     }
 }



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