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



Author: ok
Date: Sun Nov 16 15:43:16 2008
New Revision: 2764
URL: http://svn.gnome.org/viewvc/gegl?rev=2764&view=rev

Log:
* gegl/operation/gegl-operation-context.[ch]:
(gegl_operation_context_new), (gegl_operation_context_destroy),
(gegl_operation_context_get_target): made GeglOperationContext be a
struct the is slice allocated instead of a full blown GObject.
* gegl/graph/gegl-node.c: (gegl_node_remove_context),
(gegl_node_add_context): use the new functions to create/destroy
the GeglOperationContexts.


Modified:
   trunk/ChangeLog
   trunk/gegl/graph/gegl-node.c
   trunk/gegl/operation/gegl-operation-context.c
   trunk/gegl/operation/gegl-operation-context.h

Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c	(original)
+++ trunk/gegl/graph/gegl-node.c	Sun Nov 16 15:43:16 2008
@@ -1655,7 +1655,7 @@
     }
   priv = GEGL_NODE_GET_PRIVATE (self);
   g_hash_table_remove (priv->contexts, context_id);
-  g_object_unref (context);
+  gegl_operation_context_destroy (context);
 }
 
 GeglOperationContext *
@@ -1678,7 +1678,7 @@
       return context;
     }
 
-  context             = g_object_new (GEGL_TYPE_OPERATION_CONTEXT, NULL);
+  context             = gegl_operation_context_new ();
   context->operation  = self->operation;
   g_hash_table_insert (priv->contexts, context_id, context);
   return context;

Modified: trunk/gegl/operation/gegl-operation-context.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-context.c	(original)
+++ trunk/gegl/operation/gegl-operation-context.c	Sun Nov 16 15:43:16 2008
@@ -33,9 +33,6 @@
 
 #include "operation/gegl-operation.h"
 
-static void     gegl_operation_context_class_init   (GeglOperationContextClass  *klass);
-static void     gegl_operation_context_init         (GeglOperationContext *self);
-static void     finalize                       (GObject         *gobject);
 static GValue * gegl_operation_context_get_value    (GeglOperationContext *self,
                                                 const gchar     *property_name);
 static GValue *
@@ -43,22 +40,6 @@
                                   const gchar          *property_name,
                                   GType                 proptype);
 
-G_DEFINE_TYPE (GeglOperationContext, gegl_operation_context, G_TYPE_OBJECT);
-
-static void
-gegl_operation_context_class_init (GeglOperationContextClass *klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
-  gobject_class->finalize = finalize;
-}
-
-static void
-gegl_operation_context_init (GeglOperationContext *self)
-{
-  self->refs = 0;
-  self->cached = FALSE;
-}
 
 void
 gegl_operation_context_set_need_rect (GeglOperationContext *self,
@@ -239,10 +220,14 @@
   return &property->value;
 }
 
-static void
-finalize (GObject *gobject)
+GeglOperationContext *gegl_operation_context_new (void)
+{
+  GeglOperationContext *self = g_slice_new0 (GeglOperationContext);
+  return self;
+}
+
+void gegl_operation_context_destroy (GeglOperationContext *self)
 {
-  GeglOperationContext *self = GEGL_OPERATION_CONTEXT (gobject);
 
   while (self->property)
     {
@@ -250,10 +235,10 @@
       self->property = g_slist_remove (self->property, property);
       property_destroy (property);
     }
-
-  G_OBJECT_CLASS (gegl_operation_context_parent_class)->finalize (gobject);
+  g_slice_free (GeglOperationContext, self);
 }
 
+
 void
 gegl_operation_context_set_object (GeglOperationContext *context,
                                    const gchar          *padname,
@@ -355,7 +340,9 @@
   GeglNode            *node;
   GeglOperation       *operation;
 
+#if 0
   g_return_val_if_fail (GEGL_IS_OPERATION_CONTEXT (context), NULL);
+#endif
 
   operation = context->operation;
   node = operation->node; /* <ick */

Modified: trunk/gegl/operation/gegl-operation-context.h
==============================================================================
--- trunk/gegl/operation/gegl-operation-context.h	(original)
+++ trunk/gegl/operation/gegl-operation-context.h	Sun Nov 16 15:43:16 2008
@@ -24,18 +24,8 @@
 
 G_BEGIN_DECLS
 
-#define GEGL_TYPE_OPERATION_CONTEXT            (gegl_operation_context_get_type ())
-#define GEGL_OPERATION_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_CONTEXT, GeglOperationContext))
-#define GEGL_OPERATION_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_OPERATION_CONTEXT, GeglOperationContextClass))
-#define GEGL_IS_OPERATION_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_CONTEXT))
-#define GEGL_IS_OPERATION_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_OPERATION_CONTEXT))
-#define GEGL_OPERATION_CONTEXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_OPERATION_CONTEXT, GeglOperationContextClass))
-
-typedef struct _GeglOperationContextClass GeglOperationContextClass;
-
 struct _GeglOperationContext
 {
-  GObject        parent_instance;
   GeglOperation *operation;
 
   GSList        *property;    /* used internally for data being exchanged */
@@ -61,13 +51,6 @@
                                 */
 };
 
-struct _GeglOperationContextClass
-{
-  GObjectClass   parent_class;
-};
-
-GType           gegl_operation_context_get_type        (void) G_GNUC_CONST;
-
 GeglBuffer     *gegl_operation_context_get_target      (GeglOperationContext *self,
                                                         const gchar          *padname);
 GeglBuffer     *gegl_operation_context_get_source      (GeglOperationContext *self,
@@ -95,6 +78,8 @@
 void            gegl_operation_context_set_result_rect (GeglOperationContext *node,
                                                         const GeglRectangle  *rect);
 
+GeglOperationContext *gegl_operation_context_new (void);
+void gegl_operation_context_destroy (GeglOperationContext *opcontext);
 
 G_END_DECLS
 



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