gegl r2474 - in trunk: . gegl/graph gegl/operation gegl/process
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2474 - in trunk: . gegl/graph gegl/operation gegl/process
- Date: Sun, 15 Jun 2008 17:54:31 +0000 (UTC)
Author: ok
Date: Sun Jun 15 17:54:31 2008
New Revision: 2474
URL: http://svn.gnome.org/viewvc/gegl?rev=2474&view=rev
Log:
* gegl/graph/Makefile.am:
* gegl/operation/Makefile.am:
* gegl/graph/gegl-node.[ch]: made operation contexts be stored in a
hash table.
* gegl/graph/gegl-operation-context.c:
* gegl/graph/gegl-operation-context.h: moved these ...
* gegl/operation/gegl-operation-context.c: ... here.
* gegl/operation/gegl-operation-context.h: also made the set_rect
functions take rectangles as the argument.
* gegl/operation/gegl-operations.c:
* gegl/process/gegl-cr-visitor.c:
* gegl/process/gegl-debug-rect-visitor.c:
* gegl/process/gegl-eval-visitor.c: fixed include path.
* gegl/process/gegl-processor.c: fix include path, updated api use.
Added:
trunk/gegl/operation/gegl-operation-context.c
- copied, changed from r2471, /trunk/gegl/graph/gegl-operation-context.c
trunk/gegl/operation/gegl-operation-context.h
- copied, changed from r2471, /trunk/gegl/graph/gegl-operation-context.h
Removed:
trunk/gegl/graph/gegl-operation-context.c
trunk/gegl/graph/gegl-operation-context.h
Modified:
trunk/ChangeLog
trunk/gegl/graph/Makefile.am
trunk/gegl/graph/gegl-node.c
trunk/gegl/graph/gegl-node.h
trunk/gegl/operation/Makefile.am
trunk/gegl/operation/gegl-operations.c
trunk/gegl/process/gegl-cr-visitor.c
trunk/gegl/process/gegl-debug-rect-visitor.c
trunk/gegl/process/gegl-eval-visitor.c
trunk/gegl/process/gegl-processor.c
Modified: trunk/gegl/graph/Makefile.am
==============================================================================
--- trunk/gegl/graph/Makefile.am (original)
+++ trunk/gegl/graph/Makefile.am Sun Jun 15 17:54:31 2008
@@ -3,7 +3,6 @@
GRAPH_sources = \
gegl-connection.c \
gegl-node.c \
- gegl-operation-context.c \
gegl-pad.c \
gegl-visitor.c \
gegl-visitable.c
@@ -12,7 +11,6 @@
GRAPH_headers = \
gegl-connection.h \
gegl-node.h \
- gegl-operation-context.h \
gegl-pad.h \
gegl-visitor.h \
gegl-visitable.h
Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c (original)
+++ trunk/gegl/graph/gegl-node.c Sun Jun 15 17:54:31 2008
@@ -67,6 +67,7 @@
GeglNode *parent;
gchar *name;
GeglProcessor *processor;
+ GHashTable *contexts;
};
@@ -208,6 +209,7 @@
priv->children = NULL;
priv->name = NULL;
priv->processor = NULL;
+ priv->contexts = g_hash_table_new (NULL, NULL);
}
static void
@@ -278,6 +280,7 @@
{
g_free (priv->name);
}
+ g_hash_table_destroy (priv->contexts);
G_OBJECT_CLASS (gegl_node_parent_class)->finalize (gobject);
}
@@ -1408,7 +1411,6 @@
g_return_if_fail (context_id != NULL);
context = gegl_node_get_context (node, context_id);
-
context->need_rect.x = x;
context->need_rect.y = y;
context->need_rect.width = width;
@@ -1517,6 +1519,8 @@
return root->have_rect;
}
+#if 1
+
void
gegl_node_process (GeglNode *self)
{
@@ -1530,7 +1534,7 @@
gegl_processor_destroy (processor);
}
-#if 0
+#else
/* simplest form of GeglProcess that processes all data in one
*
* single large chunk
@@ -1569,33 +1573,22 @@
}
#endif
-static gint
-lookup_context (gconstpointer a,
- gconstpointer context_id)
-{
- GeglOperationContext *context = (void *) a;
-
- if (context->context_id == context_id)
- return 0;
- return -1;
-}
-
void babl_backtrack (void);
GeglOperationContext *
gegl_node_get_context (GeglNode *self,
gpointer context_id)
{
- GSList *found;
GeglOperationContext *context = NULL;
+ GeglNodePrivate *priv;
g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
g_return_val_if_fail (context_id != NULL, NULL);
- found = g_slist_find_custom (self->context, context_id, lookup_context);
- if (found)
- context = found->data;
- else
+ priv = GEGL_NODE_GET_PRIVATE (self);
+
+ context = g_hash_table_lookup (priv->contexts, context_id);
+ if (!context)
{
g_warning ("didn't find %p", context_id);
babl_backtrack ();
@@ -1608,6 +1601,7 @@
gpointer context_id)
{
GeglOperationContext *context;
+ GeglNodePrivate *priv;
g_return_if_fail (GEGL_IS_NODE (self));
g_return_if_fail (context_id != NULL);
@@ -1619,7 +1613,8 @@
context_id, gegl_node_get_debug_name (self));
return;
}
- self->context = g_slist_remove (self->context, context);
+ priv = GEGL_NODE_GET_PRIVATE (self);
+ g_hash_table_remove (priv->contexts, context_id);
g_object_unref (context);
}
@@ -1628,15 +1623,13 @@
gpointer context_id)
{
GeglOperationContext *context = NULL;
- GSList *found;
+ GeglNodePrivate *priv;
g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
g_return_val_if_fail (context_id != NULL, NULL);
- found = g_slist_find_custom (self->context, context_id, lookup_context);
-
- if (found)
- context = found->data;
+ priv = GEGL_NODE_GET_PRIVATE (self);
+ context = g_hash_table_lookup (priv->contexts, context_id);
if (context)
{
@@ -1647,8 +1640,7 @@
context = g_object_new (GEGL_TYPE_OPERATION_CONTEXT, NULL);
context->operation = self->operation;
- context->context_id = context_id;
- self->context = g_slist_prepend (self->context, context);
+ g_hash_table_insert (priv->contexts, context_id, context);
return context;
}
Modified: trunk/gegl/graph/gegl-node.h
==============================================================================
--- trunk/gegl/graph/gegl-node.h (original)
+++ trunk/gegl/graph/gegl-node.h Sun Jun 15 17:54:31 2008
@@ -20,7 +20,7 @@
#ifndef __GEGL_NODE_H__
#define __GEGL_NODE_H__
-#include "gegl-operation-context.h"
+#include "operation/gegl-operation-context.h"
#include <gegl/buffer/gegl-buffer.h>
#include <gegl/buffer/gegl-cache.h>
@@ -54,8 +54,6 @@
gboolean is_root;
gboolean enabled;
- GSList *context; /*< list of GeglOperationContext's corresponding to
- evaluation contexts */
gboolean is_graph;
GeglCache *cache; /* For a node, the cache should be created at
Modified: trunk/gegl/operation/Makefile.am
==============================================================================
--- trunk/gegl/operation/Makefile.am (original)
+++ trunk/gegl/operation/Makefile.am Sun Jun 15 17:54:31 2008
@@ -14,6 +14,7 @@
gegl-operation-source.c \
gegl-operation-temporal.c \
gegl-operation-processors.c \
+ gegl-operation-context.c \
gegl-operations.c
OPERATION_headers = \
@@ -29,6 +30,7 @@
gegl-operation-sink.h \
gegl-operation-source.h \
gegl-operation-temporal.h \
+ gegl-operation-context.h \
gegl-operations.h
public_headers = \
Copied: trunk/gegl/operation/gegl-operation-context.c (from r2471, /trunk/gegl/graph/gegl-operation-context.c)
==============================================================================
--- /trunk/gegl/graph/gegl-operation-context.c (original)
+++ trunk/gegl/operation/gegl-operation-context.c Sun Jun 15 17:54:31 2008
@@ -28,8 +28,7 @@
#include "gegl-types.h"
#include "gegl-operation-context.h"
-#include "gegl-node.h"
-#include "gegl-pad.h"
+#include "gegl/graph/gegl-node.h"
#include "gegl-config.h"
#include "operation/gegl-operation.h"
@@ -61,16 +60,10 @@
void
gegl_operation_context_set_need_rect (GeglOperationContext *self,
- gint x,
- gint y,
- gint width,
- gint height)
+ const GeglRectangle *rect)
{
g_assert (self);
- self->need_rect.x = x;
- self->need_rect.y = y;
- self->need_rect.width = width;
- self->need_rect.height = height;
+ self->need_rect = *rect;
}
GeglRectangle *
@@ -81,16 +74,10 @@
void
gegl_operation_context_set_result_rect (GeglOperationContext *self,
- gint x,
- gint y,
- gint width,
- gint height)
+ const GeglRectangle *rect)
{
g_assert (self);
- self->result_rect.x = x;
- self->result_rect.y = y;
- self->result_rect.width = width;
- self->result_rect.height = height;
+ self->result_rect = *rect;
}
GeglRectangle *
@@ -280,6 +267,12 @@
g_value_set_object (&value, data);
gegl_operation_context_set_property (context, padname, &value);
}
+ else
+ {
+ g_warning ("eeek! %s\n", padname);
+ if (data)
+ g_object_unref (data); /* are we stealing the initial reference? */
+ }
g_value_unset (&value);
g_object_unref (data); /* are we stealing the initial reference? */
}
Copied: trunk/gegl/operation/gegl-operation-context.h (from r2471, /trunk/gegl/graph/gegl-operation-context.h)
==============================================================================
--- /trunk/gegl/graph/gegl-operation-context.h (original)
+++ trunk/gegl/operation/gegl-operation-context.h Sun Jun 15 17:54:31 2008
@@ -37,8 +37,8 @@
{
GObject parent_instance;
GeglOperation *operation;
- gpointer context_id;
+ GSList *property; /* used internally for data being exchanged */
GeglRectangle need_rect; /* the rectangle needed from the operation */
GeglRectangle result_rect; /* the result computation rectangle for the operation ,
(will differ if the needed rect extends beyond
@@ -46,6 +46,8 @@
force/suggest expansion of the result
rect, like contrast stretching.
*/
+
+
gboolean cached; /* true if the cache can be used directly, and
recomputation of inputs is unneccesary) */
@@ -57,7 +59,6 @@
incorporated into the refcount of
GeglOperationContext?
*/
- GSList *property; /* used internally for data being exchanged */
};
struct _GeglOperationContextClass
@@ -89,16 +90,10 @@
const gchar *name);
GeglRectangle * gegl_operation_context_get_need_rect (GeglOperationContext *self);
void gegl_operation_context_set_need_rect (GeglOperationContext *self,
- gint x,
- gint y,
- gint width,
- gint height);
+ const GeglRectangle *rect);
GeglRectangle * gegl_operation_context_get_result_rect (GeglOperationContext *node);
void gegl_operation_context_set_result_rect (GeglOperationContext *node,
- gint x,
- gint y,
- gint width,
- gint height);
+ const GeglRectangle *rect);
G_END_DECLS
Modified: trunk/gegl/operation/gegl-operations.c
==============================================================================
--- trunk/gegl/operation/gegl-operations.c (original)
+++ trunk/gegl/operation/gegl-operations.c Sun Jun 15 17:54:31 2008
@@ -30,7 +30,7 @@
#include "gegl-operations.h"
#include "graph/gegl-node.h"
#include "graph/gegl-pad.h"
-#include "graph/gegl-operation-context.h"
+#include "gegl-operation-context.h"
#include "buffer/gegl-region.h"
static void
@@ -174,7 +174,7 @@
}
}
- gegl_node_set_need_rect (child, context_id,
+ gegl_node_set_need_rect (child, context_id,
child_need.x, child_need.y,
child_need.width, child_need.height);
}
Modified: trunk/gegl/process/gegl-cr-visitor.c
==============================================================================
--- trunk/gegl/process/gegl-cr-visitor.c (original)
+++ trunk/gegl/process/gegl-cr-visitor.c Sun Jun 15 17:54:31 2008
@@ -25,8 +25,8 @@
#include "gegl-cr-visitor.h"
#include "operation/gegl-operation.h"
+#include "operation/gegl-operation-context.h"
#include "graph/gegl-node.h"
-#include "graph/gegl-operation-context.h"
#include "graph/gegl-pad.h"
#include "graph/gegl-visitable.h"
#include "gegl-utils.h"
Modified: trunk/gegl/process/gegl-debug-rect-visitor.c
==============================================================================
--- trunk/gegl/process/gegl-debug-rect-visitor.c (original)
+++ trunk/gegl/process/gegl-debug-rect-visitor.c Sun Jun 15 17:54:31 2008
@@ -27,8 +27,8 @@
#include "gegl-debug-rect-visitor.h"
#include "operation/gegl-operation.h"
+#include "operation/gegl-operation-context.h"
#include "graph/gegl-node.h"
-#include "graph/gegl-operation-context.h"
#include "graph/gegl-pad.h"
#include "graph/gegl-visitable.h"
Modified: trunk/gegl/process/gegl-eval-visitor.c
==============================================================================
--- trunk/gegl/process/gegl-eval-visitor.c (original)
+++ trunk/gegl/process/gegl-eval-visitor.c Sun Jun 15 17:54:31 2008
@@ -25,11 +25,11 @@
#include "gegl-eval-visitor.h"
#include "graph/gegl-node.h"
-#include "graph/gegl-operation-context.h"
+#include "operation/gegl-operation.h"
+#include "operation/gegl-operation-context.h"
#include "graph/gegl-pad.h"
#include "graph/gegl-visitable.h"
#include "gegl-instrument.h"
-#include "operation/gegl-operation.h"
#include "operation/gegl-operation-sink.h"
#include "buffer/gegl-region.h"
Modified: trunk/gegl/process/gegl-processor.c
==============================================================================
--- trunk/gegl/process/gegl-processor.c (original)
+++ trunk/gegl/process/gegl-processor.c Sun Jun 15 17:54:31 2008
@@ -323,15 +323,9 @@
}
gegl_operation_context_set_result_rect (processor->context,
- processor->rectangle.x,
- processor->rectangle.y,
- processor->rectangle.width,
- processor->rectangle.height);
+ &processor->rectangle);
gegl_operation_context_set_need_rect (processor->context,
- processor->rectangle.x,
- processor->rectangle.y,
- processor->rectangle.width,
- processor->rectangle.height);
+ &processor->rectangle);
}
return processor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]