gegl r2461 - in trunk: . gegl/process



Author: martinn
Date: Sat Jun 14 20:09:19 2008
New Revision: 2461
URL: http://svn.gnome.org/viewvc/gegl?rev=2461&view=rev

Log:
2008-06-14  Martin Nordholts  <martinn svn gnome org>

	* gegl/process/gegl-processor.c (gegl_node_new_processor): Move
	the extra initialization code to the constructor so that this is a
	clean wrapper around g_object_new().


Modified:
   trunk/ChangeLog
   trunk/gegl/process/gegl-processor.c

Modified: trunk/gegl/process/gegl-processor.c
==============================================================================
--- trunk/gegl/process/gegl-processor.c	(original)
+++ trunk/gegl/process/gegl-processor.c	Sat Jun 14 20:09:19 2008
@@ -162,6 +162,42 @@
 
   processor->queued_region = gegl_region_new ();
 
+  if (processor->node->operation &&
+      GEGL_IS_OPERATION_SINK (processor->node->operation))
+    {
+      GeglCache     *cache;
+
+      if (!gegl_operation_sink_needs_full (processor->node->operation))
+        {
+          return object;
+        }
+      cache = gegl_node_get_cache (processor->input);
+
+      processor->context = gegl_node_add_context (processor->node, cache);
+      {
+        GValue value = { 0, };
+        g_value_init (&value, GEGL_TYPE_BUFFER);
+        g_value_set_object (&value, cache);
+        gegl_node_context_set_property (processor->context, "input", &value);
+        g_value_unset (&value);
+      }
+
+      gegl_node_context_set_result_rect (processor->context,
+                                         processor->rectangle.x,
+                                         processor->rectangle.y,
+                                         processor->rectangle.width,
+                                         processor->rectangle.height);
+      gegl_node_context_set_need_rect   (processor->context,
+                                         processor->rectangle.x,
+                                         processor->rectangle.y,
+                                         processor->rectangle.width,
+                                         processor->rectangle.height);
+    }
+  else
+    {
+      processor->context = NULL;
+    }
+
   return object;
 }
 
@@ -293,52 +329,12 @@
 gegl_node_new_processor (GeglNode            *node,
                          const GeglRectangle *rectangle)
 {
-  GeglProcessor *processor;
-
   g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
 
-  processor = g_object_new (GEGL_TYPE_PROCESSOR,
-                            "node",      node,
-                            "rectangle", rectangle,
-                            NULL);
-
-  if (node->operation &&
-      GEGL_IS_OPERATION_SINK (node->operation))
-    {
-      GeglCache     *cache;
-
-      if (!gegl_operation_sink_needs_full (node->operation))
-        {
-          return processor;
-        }
-      cache = gegl_node_get_cache (processor->input);
-
-      processor->context = gegl_node_add_context (node, cache);
-      {
-        GValue value = { 0, };
-        g_value_init (&value, GEGL_TYPE_BUFFER);
-        g_value_set_object (&value, cache);
-        gegl_node_context_set_property (processor->context, "input", &value);
-        g_value_unset (&value);
-      }
-
-      gegl_node_context_set_result_rect (processor->context,
-                                         processor->rectangle.x,
-                                         processor->rectangle.y,
-                                         processor->rectangle.width,
-                                         processor->rectangle.height);
-      gegl_node_context_set_need_rect   (processor->context,
-                                         processor->rectangle.x,
-                                         processor->rectangle.y,
-                                         processor->rectangle.width,
-                                         processor->rectangle.height);
-    }
-  else
-    {
-      processor->context = NULL;
-    }
-
-  return processor;
+  return g_object_new (GEGL_TYPE_PROCESSOR,
+                       "node",      node,
+                       "rectangle", rectangle,
+                       NULL);
 }
 
 /* returns TRUE if there is more work */



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