gimp r24559 - in trunk: . app/gegl app/gegl/gegl



Author: mitch
Date: Mon Jan  7 15:33:02 2008
New Revision: 24559
URL: http://svn.gnome.org/viewvc/gimp?rev=24559&view=rev

Log:
2008-01-07  Michael Natterer  <mitch gimp org>

	* app/gegl/gegl/gegl-operation.h: updated from GEGL.

	* app/gegl/gimpoperationtilesource.c: use the passed buffer in
	process() and add prepare() implementation which sets the format.



Modified:
   trunk/ChangeLog
   trunk/app/gegl/gegl/gegl-operation.h
   trunk/app/gegl/gimpoperationtilesource.c

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Mon Jan  7 15:33:02 2008
@@ -1,3 +1,10 @@
+2008-01-07  Michael Natterer  <mitch gimp org>
+
+	* app/gegl/gegl/gegl-operation.h: updated from GEGL.
+
+	* app/gegl/gimpoperationtilesource.c: use the passed buffer in
+	process() and add prepare() implementation which sets the format.
+
 2008-01-05  Joao S. O. Bueno <gwidion mpc com br>
 
 	* plug-ins/pygimp/pygimp-vectors.c: fixed incorrect function name

Modified: trunk/app/gegl/gegl/gegl-operation.h
==============================================================================
--- trunk/app/gegl/gegl/gegl-operation.h	(original)
+++ trunk/app/gegl/gegl/gegl-operation.h	Mon Jan  7 15:33:02 2008
@@ -188,7 +188,9 @@
  * turn into a global mechanism) */
 void       gegl_operation_set_format                (GeglOperation *operation,
                                                      const gchar   *pad_name,
-                                                     Babl          *format);
+                                                     const Babl    *format);
+const Babl * gegl_operation_get_format              (GeglOperation *operation,
+                                                     const gchar   *pad_name);
 
 /* Used to look up the gtype when changing the type of operation associated
  * a GeglNode using just a string with the registered name.

Modified: trunk/app/gegl/gimpoperationtilesource.c
==============================================================================
--- trunk/app/gegl/gimpoperationtilesource.c	(original)
+++ trunk/app/gegl/gimpoperationtilesource.c	Mon Jan  7 15:33:02 2008
@@ -56,9 +56,9 @@
                                                          const GValue  *value,
                                                          GParamSpec    *pspec);
 
+static void     gimp_operation_tile_source_prepare      (GeglOperation *operation);
 static GeglRectangle
           gimp_operation_tile_source_get_defined_region (GeglOperation *operation);
-
 static gboolean gimp_operation_tile_source_process      (GeglOperation *operation,
                                                          GeglNodeContext *context,
                                                          GeglBuffer          *output,
@@ -82,6 +82,7 @@
   object_class->set_property          = gimp_operation_tile_source_set_property;
   object_class->get_property          = gimp_operation_tile_source_get_property;
 
+  operation_class->prepare            = gimp_operation_tile_source_prepare;
   operation_class->get_defined_region = gimp_operation_tile_source_get_defined_region;
   operation_class->adjust_result_region = NULL; /* the default source is
                                                  expanding to agressivly
@@ -180,6 +181,25 @@
     }
 }
 
+static void
+gimp_operation_tile_source_prepare (GeglOperation *operation)
+{
+  GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation);
+
+  if (self->tile_manager)
+    {
+      const Babl *format;
+      guint       bpp = tile_manager_bpp (self->tile_manager);
+
+      if (self->linear)
+        format = gimp_bpp_to_babl_format_linear (bpp);
+      else
+        format = gimp_bpp_to_babl_format (bpp);
+
+      gegl_operation_set_format (operation, "output", format);
+    }
+}
+
 static GeglRectangle
 gimp_operation_tile_source_get_defined_region (GeglOperation *operation)
 {
@@ -207,18 +227,11 @@
 
   if (self->tile_manager)
     {
-      GeglBuffer  *output;
       const Babl  *format;
       PixelRegion  srcPR;
-      guint        bpp = tile_manager_bpp (self->tile_manager);
       gpointer     pr;
 
-      if (self->linear) /* FIXME: this should be set in prepare and not process */
-        format = gimp_bpp_to_babl_format_linear (bpp);
-      else
-        format = gimp_bpp_to_babl_format (bpp);
-
-      output = gegl_buffer_new (result, format); /* FIXME: use the passed in buffer */
+      format = gegl_operation_get_format (operation, "output");
 
       pixel_region_init (&srcPR, self->tile_manager,
                          result->x,     result->y,
@@ -233,10 +246,6 @@
 
           gegl_buffer_set (output, &rect, format, srcPR.data, srcPR.rowstride);
         }
-
-      gegl_node_context_set_object (context, "output", G_OBJECT (output)); /* FIXME: should not be needed
-                                                                              if using the passed in 
-                                                                              buffer */
     }
 
   return TRUE;



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