gegl r2457 - in trunk: . gegl/process



Author: martinn
Date: Sat Jun 14 18:38:30 2008
New Revision: 2457
URL: http://svn.gnome.org/viewvc/gegl?rev=2457&view=rev

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

	* gegl/process/gegl-processor.c: Made the processing rectangle
	accessible as a GObject property.

	(gegl_processor_set_rectangle): When passed a NULL rectangle, use
	the bounding box of the input node.

	(gegl_node_new_processor): Simply pass the rectangle to
	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 18:38:30 2008
@@ -31,7 +31,8 @@
   PROP_0,
   PROP_NODE,
   PROP_CHUNK_SIZE,
-  PROP_PROGRESS
+  PROP_PROGRESS,
+  PROP_RECTANGLE
 };
 
 static void      gegl_processor_class_init (GeglProcessorClass    *klass);
@@ -88,6 +89,10 @@
                                                         G_PARAM_WRITABLE |
                                                         G_PARAM_CONSTRUCT));
 
+  g_object_class_install_property (gobject_class, PROP_RECTANGLE,
+                                   g_param_spec_pointer ("rectangle", "rectangle", "The rectangle of the region to process.",
+                                                         G_PARAM_READWRITE));
+
   g_object_class_install_property (gobject_class, PROP_PROGRESS,
                                    g_param_spec_double ("progress", "progress", "query progress 0.0 is not started 1.0 is done.",
                                                      0.0, 1.0, 0.0,
@@ -186,6 +191,10 @@
         self->chunk_size = g_value_get_int (value);
         break;
 
+      case PROP_RECTANGLE:
+        gegl_processor_set_rectangle (self, g_value_get_pointer (value));
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
         break;
@@ -206,6 +215,10 @@
         g_value_set_object (value, self->node);
         break;
 
+      case PROP_RECTANGLE:
+        g_value_set_pointer (value, &self->rectangle);
+        break;
+
       case PROP_CHUNK_SIZE:
         g_value_set_int (value, self->chunk_size);
         break;
@@ -225,6 +238,13 @@
 {
   GSList        *iter;
   GeglRectangle  bounds;
+  GeglRectangle  input_bounding_box;
+
+  if (! rectangle)
+    {
+      input_bounding_box = gegl_node_get_bounding_box (processor->input);
+      rectangle          = &input_bounding_box;
+    }
 
   if (gegl_rectangle_equal (&processor->rectangle, rectangle))
     return;
@@ -248,17 +268,10 @@
 
   g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
 
-  processor = g_object_new (GEGL_TYPE_PROCESSOR, "node", node, NULL);
-
-  if (rectangle)
-    {
-      gegl_processor_set_rectangle (processor, rectangle);
-    }
-  else
-    {
-      GeglRectangle tmp = gegl_node_get_bounding_box (processor->input);
-      gegl_processor_set_rectangle (processor, &tmp);
-    }
+  processor = g_object_new (GEGL_TYPE_PROCESSOR,
+                            "node",      node,
+                            "rectangle", rectangle,
+                            NULL);
 
   if (node->operation &&
       GEGL_IS_OPERATION_SINK (node->operation))



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