gegl r2759 - in trunk: . gegl/graph gegl/process
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2759 - in trunk: . gegl/graph gegl/process
- Date: Sun, 16 Nov 2008 02:24:09 +0000 (UTC)
Author: ok
Date: Sun Nov 16 02:24:09 2008
New Revision: 2759
URL: http://svn.gnome.org/viewvc/gegl?rev=2759&view=rev
Log:
* gegl/graph/gegl-node.c: (dispose), (ensure_eval_mgr),
(gegl_node_apply_roi), (gegl_node_blit), (gegl_node_process):
* gegl/graph/gegl-node.h: keep a cached eval_mgr with the node.
* gegl/process/gegl-eval-mgr.[ch]: (gegl_eval_mgr_apply): made
the eval mgr keep track of the node and pad it is computing for.
Modified:
trunk/ChangeLog
trunk/gegl/graph/gegl-node.c
trunk/gegl/graph/gegl-node.h
trunk/gegl/process/gegl-eval-mgr.c
trunk/gegl/process/gegl-eval-mgr.h
Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c (original)
+++ trunk/gegl/graph/gegl-node.c Sun Nov 16 02:24:09 2008
@@ -67,6 +67,7 @@
GeglNode *parent;
gchar *name;
GeglProcessor *processor;
+ GeglEvalMgr *eval_mgr;
GHashTable *contexts;
};
@@ -243,6 +244,12 @@
self->cache = NULL;
}
+ if (priv->eval_mgr)
+ {
+ g_object_unref (priv->eval_mgr);
+ priv->eval_mgr = NULL;
+ }
+
if (priv->processor)
{
gegl_processor_destroy (priv->processor);
@@ -787,36 +794,38 @@
va_end (var_args);
}
+static void ensure_eval_mgr (GeglNode *node,
+ const gchar *pad)
+{
+ GeglNodePrivate *priv;
+ priv = GEGL_NODE_GET_PRIVATE (node);
+ if (!priv->eval_mgr)
+ priv->eval_mgr = gegl_eval_mgr_new (node, pad);
+}
+
static GeglBuffer *
gegl_node_apply_roi (GeglNode *self,
const gchar *output_pad_name,
const GeglRectangle *roi)
{
- GeglEvalMgr *eval_mgr;
+ GeglNodePrivate *priv;
GeglBuffer *buffer;
- eval_mgr = g_object_new (GEGL_TYPE_EVAL_MGR, NULL);
- eval_mgr->roi = *roi;
- buffer = gegl_eval_mgr_apply (eval_mgr, self, output_pad_name);
-
- g_object_unref (eval_mgr);
+ priv = GEGL_NODE_GET_PRIVATE (self);
+ ensure_eval_mgr (self, output_pad_name);
+ if (roi)
+ {
+ priv->eval_mgr->roi = *roi;
+ }
+ else
+ {
+ priv->eval_mgr->roi = gegl_node_get_bounding_box (self);
+ }
+ buffer = gegl_eval_mgr_apply (priv->eval_mgr);
return buffer;
}
-GeglBuffer *
-gegl_node_apply (GeglNode *self,
- const gchar *output_prop_name)
-{
- GeglRectangle defined;
-
- g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
-
- defined = gegl_node_get_bounding_box (self);
- return gegl_node_apply_roi (self, "output", &defined);
-}
-
-
void
gegl_node_blit (GeglNode *node,
gdouble scale,
@@ -829,9 +838,20 @@
g_return_if_fail (GEGL_IS_NODE (node));
g_return_if_fail (roi != NULL);
+#if 0
+ if (flags == GEGL_BLIT_DEFAULT)
+ flags = GEGL_BLIT_CACHE;
+#endif
+
+ /* temporarily made blit use caching, but render
+ * blocking, this to be able to have less coupling
+ * with the processor
+ */
+#if 1
if (flags == GEGL_BLIT_DEFAULT)
{
GeglBuffer *buffer;
+
buffer = gegl_node_apply_roi (node, "output", roi);
if (buffer && destination_buf)
{
@@ -850,16 +870,20 @@
if (buffer)
g_object_unref (buffer);
}
- else if ((flags & GEGL_BLIT_CACHE) ||
+ else
+#endif
+
+ if ((flags & GEGL_BLIT_CACHE) ||
(flags & GEGL_BLIT_DIRTY))
{
GeglCache *cache = gegl_node_get_cache (node);
if (!(flags & GEGL_BLIT_DIRTY))
- { /* if we're not blitting dirtily, we need to make sure
- that the data is available */
- GeglProcessor *processor = gegl_node_new_processor (node, roi);
- while (gegl_processor_work (processor, NULL)) ;
- g_object_unref (G_OBJECT (processor));
+ {
+ GeglNodePrivate *priv = GEGL_NODE_GET_PRIVATE (node);
+ if (!priv->processor)
+ priv->processor = gegl_node_new_processor (node, roi);
+ gegl_processor_set_rectangle (priv->processor, roi);
+ while (gegl_processor_work (priv->processor, NULL)) ;
}
if (destination_buf)
{
@@ -1539,6 +1563,7 @@
void
gegl_node_process (GeglNode *self)
{
+ /* XXX: should perhaps use the internal processor? */
GeglProcessor *processor;
g_return_if_fail (GEGL_IS_NODE (self));
Modified: trunk/gegl/graph/gegl-node.h
==============================================================================
--- trunk/gegl/graph/gegl-node.h (original)
+++ trunk/gegl/graph/gegl-node.h Sun Nov 16 02:24:09 2008
@@ -97,6 +97,7 @@
gint rowstride,
GeglBlitFlags flags);
+void gegl_node_process (GeglNode *self);
void gegl_node_link (GeglNode *source,
GeglNode *sink);
@@ -155,9 +156,6 @@
gchar *pad_name,
gchar **output_pad);
GSList * gegl_node_get_depends_on (GeglNode *self);
-GeglBuffer * gegl_node_apply (GeglNode *self,
- const gchar *output_pad_name);
-void gegl_node_process (GeglNode *self);
void gegl_node_set_valist (GeglNode *object,
const gchar *first_property_name,
va_list var_args);
Modified: trunk/gegl/process/gegl-eval-mgr.c
==============================================================================
--- trunk/gegl/process/gegl-eval-mgr.c (original)
+++ trunk/gegl/process/gegl-eval-mgr.c Sun Nov 16 02:24:09 2008
@@ -67,10 +67,9 @@
* Update this property.
**/
GeglBuffer *
-gegl_eval_mgr_apply (GeglEvalMgr *self,
- GeglNode *root,
- const gchar *pad_name)
+gegl_eval_mgr_apply (GeglEvalMgr *self)
{
+ GeglNode *root;
GeglBuffer *buffer;
GeglVisitor *prepare_visitor;
GeglVisitor *have_visitor;
@@ -83,14 +82,11 @@
gpointer context_id = self;
g_assert (GEGL_IS_EVAL_MGR (self));
- g_assert (GEGL_IS_NODE (root));
gegl_instrument ("gegl", "process", 0);
- if (pad_name == NULL)
- pad_name = "output";
- pad = gegl_node_get_pad (root, pad_name);
-
+ root=self->node;
+ pad = gegl_node_get_pad (root, self->pad_name);
/* Use the redirect output NOP of a graph instead of a graph if a traversal
* is attempted directly on a graph */
if (pad && pad->node != root)
@@ -186,3 +182,19 @@
}
return buffer;
}
+
+GeglEvalMgr * gegl_eval_mgr_new (GeglNode *node,
+ const gchar *pad_name)
+{
+ GeglEvalMgr *self = g_object_new (GEGL_TYPE_EVAL_MGR, NULL);
+ g_assert (GEGL_IS_NODE (node));
+ self->node = node;
+ if (pad_name)
+ self->pad_name = g_strdup (pad_name);
+ else
+ self->pad_name = g_strdup ("output");
+/* g_signal_connect (G_OBJECT (node->operation), "notify", G_CALLBACK (deprime), self);
+ g_signal_connect (G_OBJECT (node), "invalidated", G_CALLBACK (deprime), self);*/
+ return self;
+}
+
Modified: trunk/gegl/process/gegl-eval-mgr.h
==============================================================================
--- trunk/gegl/process/gegl-eval-mgr.h (original)
+++ trunk/gegl/process/gegl-eval-mgr.h Sun Nov 16 02:24:09 2008
@@ -37,7 +37,9 @@
struct _GeglEvalMgr
{
- GObject parent_instance;
+ GObject parent_instance;
+ GeglNode *node;
+ gchar *pad_name;
GeglRectangle roi;
};
@@ -50,8 +52,8 @@
GType gegl_eval_mgr_get_type (void) G_GNUC_CONST;
-GeglBuffer * gegl_eval_mgr_apply (GeglEvalMgr *self,
- GeglNode *root,
+GeglBuffer * gegl_eval_mgr_apply (GeglEvalMgr *self);
+GeglEvalMgr * gegl_eval_mgr_new (GeglNode *node,
const gchar *property_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]