gegl r1816 - in trunk: . gegl/graph gegl/operation



Author: mitch
Date: Mon Jan  7 15:20:32 2008
New Revision: 1816
URL: http://svn.gnome.org/viewvc/gegl?rev=1816&view=rev

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

	* gegl/graph/gegl-pad.[ch] (struct GeglPad): changed member "format"
	from "gpointer" to "const Babl*".

	(gegl_pad_get_format)
	(gegl_pad_set_format): changed gpointer to const Babl* too.

	* gegl/operation/gegl-operation.[ch] (gegl_operation_set_format):
	constified Babl* parameter.

	(gegl_operation_get_format): new function.

	* gegl/graph/gegl-node.c
	* gegl/graph/gegl-node-context.c
	* gegl/operation/gegl-operation-point-filter.c
	* gegl/operation/gegl-operation-point-composer.c: changed
	accordingly (constified Babl*).



Modified:
   trunk/ChangeLog
   trunk/gegl/graph/gegl-node-context.c
   trunk/gegl/graph/gegl-node.c
   trunk/gegl/graph/gegl-pad.c
   trunk/gegl/graph/gegl-pad.h
   trunk/gegl/operation/gegl-operation-point-composer.c
   trunk/gegl/operation/gegl-operation-point-filter.c
   trunk/gegl/operation/gegl-operation.c
   trunk/gegl/operation/gegl-operation.h

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Mon Jan  7 15:20:32 2008
@@ -1,3 +1,22 @@
+2008-01-07  Michael Natterer  <mitch gimp org>
+
+	* gegl/graph/gegl-pad.[ch] (struct GeglPad): changed member "format"
+	from "gpointer" to "const Babl*".
+
+	(gegl_pad_get_format)
+	(gegl_pad_set_format): changed gpointer to const Babl* too.
+
+	* gegl/operation/gegl-operation.[ch] (gegl_operation_set_format):
+	constified Babl* parameter.
+
+	(gegl_operation_get_format): new function.
+
+	* gegl/graph/gegl-node.c
+	* gegl/graph/gegl-node-context.c
+	* gegl/operation/gegl-operation-point-filter.c
+	* gegl/operation/gegl-operation-point-composer.c: changed
+	accordingly (constified Babl*).
+
 2008-01-06  Kevin Cozens  <kcozens cvs gnome org>
 
 	* gegl/gegl-init.c: Made variable module_db global to file. Unref it

Modified: trunk/gegl/graph/gegl-node-context.c
==============================================================================
--- trunk/gegl/graph/gegl-node-context.c	(original)
+++ trunk/gegl/graph/gegl-node-context.c	Mon Jan  7 15:20:32 2008
@@ -313,15 +313,17 @@
   GeglBuffer          *output;
   GeglPad             *pad;
   const GeglRectangle *result;
-  Babl                *format;
+  const Babl          *format;
   GeglNode            *node;
   GeglOperation       *operation;
 
+  g_return_val_if_fail (GEGL_IS_NODE_CONTEXT (context), NULL);
+
   node = context->node;
   operation = node->operation;
- 
+
   pad = gegl_node_get_pad (node, padname);
-  format = pad->format;
+  format = gegl_pad_get_format (pad);
 
   if (format == NULL)
     {
@@ -330,7 +332,6 @@
     }
   g_assert (format != NULL);
   g_assert (!strcmp (padname, "output"));
-  g_assert (context);
 
   result = &context->result_rect;
 

Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c	(original)
+++ trunk/gegl/graph/gegl-node.c	Mon Jan  7 15:20:32 2008
@@ -1700,14 +1700,16 @@
 GeglCache *
 gegl_node_get_cache (GeglNode *node)
 {
+  g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
+
   if (!node->cache)
     {
-      GeglPad *pad;
-      Babl *format;
+      GeglPad    *pad;
+      const Babl *format;
 
       pad = gegl_node_get_pad (node, "output");
       g_assert (pad);
-      format = pad->format;
+      format = gegl_pad_get_format (pad);
       if (!format)
         {
           format = babl_format ("RGBA float");

Modified: trunk/gegl/graph/gegl-pad.c
==============================================================================
--- trunk/gegl/graph/gegl-pad.c	(original)
+++ trunk/gegl/graph/gegl-pad.c	Mon Jan  7 15:20:32 2008
@@ -322,13 +322,18 @@
 }
 
 void
-gegl_pad_set_format (GeglPad  *self,
-                     gpointer  format)
+gegl_pad_set_format (GeglPad    *self,
+                     const Babl *format)
 {
-  self->format=format;
+  g_return_if_fail (GEGL_IS_PAD (self));
+
+  self->format = format;
 }
 
-gpointer gegl_pad_get_format (GeglPad *self)
+const Babl *
+gegl_pad_get_format (GeglPad *self)
 {
+  g_return_val_if_fail (GEGL_IS_PAD (self), NULL);
+
   return self->format;
 }

Modified: trunk/gegl/graph/gegl-pad.h
==============================================================================
--- trunk/gegl/graph/gegl-pad.h	(original)
+++ trunk/gegl/graph/gegl-pad.h	Mon Jan  7 15:20:32 2008
@@ -49,7 +49,7 @@
   GParamSpec    *param_spec;
   GeglNode      *node;
   GSList        *connections;
-  gpointer       format;      /* pixel format this pad produces/consumes,
+  const Babl    *format;      /* pixel format this pad produces/consumes,
                                  (initially only what it produces, and used
                                   for gegl_operation_get_target.)
                                */
@@ -63,7 +63,7 @@
 
 
 GType            gegl_pad_get_type                  (void) G_GNUC_CONST;
- 
+
 const gchar    * gegl_pad_get_name                  (GeglPad        *self);
 void             gegl_pad_set_name                  (GeglPad        *self,
                                                      const gchar    *name);
@@ -88,8 +88,8 @@
                                                      GParamSpec     *param_spec);
 
 void             gegl_pad_set_format                (GeglPad        *self,
-                                                     gpointer        format);
-gpointer         gegl_pad_get_format                (GeglPad        *self);
+                                                     const Babl     *format);
+const Babl     * gegl_pad_get_format                (GeglPad        *self);
 
 G_END_DECLS
 

Modified: trunk/gegl/operation/gegl-operation-point-composer.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-composer.c	(original)
+++ trunk/gegl/operation/gegl-operation-point-composer.c	Mon Jan  7 15:20:32 2008
@@ -57,11 +57,11 @@
 }
 
 static gboolean
-fast_paths (GeglOperation *operation,
-            GeglNodeContext *context,
-            Babl          *in_format,
-            Babl          *aux_format,
-            Babl          *out_format,
+fast_paths (GeglOperation       *operation,
+            GeglNodeContext     *context,
+            const Babl          *in_format,
+            const Babl          *aux_format,
+            const Babl          *out_format,
             const GeglRectangle *result);
 
 static gboolean
@@ -72,21 +72,21 @@
                GeglBuffer          *output,
                const GeglRectangle *result)
 {
-  GeglPad             *pad;
-  Babl                *in_format;
-  Babl                *aux_format;
-  Babl                *out_format;
+  GeglPad    *pad;
+  const Babl *in_format;
+  const Babl *aux_format;
+  const Babl *out_format;
 
   pad       = gegl_node_get_pad (operation->node, "input");
-  in_format = pad->format;
+  in_format = gegl_pad_get_format (pad);
   if (!in_format)
     {
       g_warning ("%s", gegl_node_get_debug_name (operation->node));
     }
   g_assert (in_format);
 
-  pad       = gegl_node_get_pad (operation->node, "aux");
-  aux_format = pad->format;
+  pad        = gegl_node_get_pad (operation->node, "aux");
+  aux_format = gegl_pad_get_format (pad);
   if (!aux_format)
     {
       g_warning ("%s", gegl_node_get_debug_name (operation->node));
@@ -94,7 +94,7 @@
   g_assert (aux_format);
 
   pad        = gegl_node_get_pad (operation->node, "output");
-  out_format = pad->format;
+  out_format = gegl_pad_get_format (pad);
   if (!out_format)
     {
       g_warning ("%s", gegl_node_get_debug_name (operation->node));
@@ -165,11 +165,11 @@
 
 
 static gboolean
-fast_paths (GeglOperation *operation,
-            GeglNodeContext *context,
-            Babl          *in_format,
-            Babl          *aux_format,
-            Babl          *out_format,
+fast_paths (GeglOperation       *operation,
+            GeglNodeContext     *context,
+            const Babl          *in_format,
+            const Babl          *aux_format,
+            const Babl          *out_format,
             const GeglRectangle *result)
 {
   GeglBuffer  *input = gegl_node_context_get_source (context, "input");

Modified: trunk/gegl/operation/gegl-operation-point-filter.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-filter.c	(original)
+++ trunk/gegl/operation/gegl-operation-point-filter.c	Mon Jan  7 15:20:32 2008
@@ -56,12 +56,12 @@
                GeglBuffer          *output,
                const GeglRectangle *result)
 {
-  GeglPad             *pad;
-  Babl                *in_format;
-  Babl                *out_format;
+  GeglPad    *pad;
+  const Babl *in_format;
+  const Babl *out_format;
 
   pad       = gegl_node_get_pad (operation->node, "input");
-  in_format = pad->format;
+  in_format = gegl_pad_get_format (pad);
   if (!in_format)
     {
       g_warning ("%s", gegl_node_get_debug_name (operation->node));
@@ -69,7 +69,7 @@
   g_assert (in_format);
 
   pad        = gegl_node_get_pad (operation->node, "output");
-  out_format = pad->format;
+  out_format = gegl_pad_get_format (pad);
   if (!out_format)
     {
       g_warning ("%s", gegl_node_get_debug_name (operation->node));

Modified: trunk/gegl/operation/gegl-operation.c
==============================================================================
--- trunk/gegl/operation/gegl-operation.c	(original)
+++ trunk/gegl/operation/gegl-operation.c	Mon Jan  7 15:20:32 2008
@@ -536,14 +536,36 @@
 void
 gegl_operation_set_format (GeglOperation *self,
                            const gchar   *pad_name,
-                           Babl          *format)
+                           const Babl    *format)
 {
-  GeglPad       *pad;
+  GeglPad *pad;
+
+  g_return_if_fail (GEGL_IS_OPERATION (self));
+  g_return_if_fail (pad_name != NULL);
 
   pad = gegl_node_get_pad (self->node, pad_name);
+
+  g_return_if_fail (pad != NULL);
+
   pad->format = format;
 }
 
+const Babl *
+gegl_operation_get_format (GeglOperation *self,
+                           const gchar   *pad_name)
+{
+  GeglPad *pad;
+
+  g_return_val_if_fail (GEGL_IS_OPERATION (self), NULL);
+  g_return_val_if_fail (pad_name != NULL, NULL);
+
+  pad = gegl_node_get_pad (self->node, pad_name);
+
+  g_return_val_if_fail (pad != NULL, NULL);
+
+  return pad->format;
+}
+
 void
 gegl_operation_vector_prop_changed (GeglVector    *vector,
                                     GeglOperation *operation)

Modified: trunk/gegl/operation/gegl-operation.h
==============================================================================
--- trunk/gegl/operation/gegl-operation.h	(original)
+++ trunk/gegl/operation/gegl-operation.h	Mon Jan  7 15:20:32 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.



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