gegl r2751 - in trunk: . gegl/graph
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2751 - in trunk: . gegl/graph
- Date: Sat, 15 Nov 2008 00:54:42 +0000 (UTC)
Author: ok
Date: Sat Nov 15 00:54:42 2008
New Revision: 2751
URL: http://svn.gnome.org/viewvc/gegl?rev=2751&view=rev
Log:
* gegl/graph/gegl-node.[ch]: (gegl_node_invalidated),
(gegl_node_apply), (invalidate_have_rect),
(gegl_node_set_operation_object), (gegl_node_get_bounding_box),
(gegl_node_process), (gegl_node_get_cache): keep track of whether
we have a valid computed have_rect in the node or not to avoid
needlessly traversing the graph to recompute the value.
Modified:
trunk/ChangeLog
trunk/gegl/graph/gegl-node.c
trunk/gegl/graph/gegl-node.h
Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c (original)
+++ trunk/gegl/graph/gegl-node.c Sat Nov 15 00:54:42 2008
@@ -541,6 +541,7 @@
gegl_buffer_clear (GEGL_BUFFER (node->cache), rect);
gegl_cache_invalidate (node->cache, rect);
}
+ node->valid_have_rect = FALSE;
g_signal_emit (node, gegl_node_signals[INVALIDATED], 0,
rect, NULL);
@@ -803,6 +804,19 @@
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,
@@ -855,17 +869,6 @@
}
}
-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);
-}
GSList *
gegl_node_get_depends_on (GeglNode *self)
@@ -977,6 +980,15 @@
}
}
+static gboolean
+invalidate_have_rect (GObject *gobject,
+ gpointer foo,
+ gpointer user_data)
+{
+ GEGL_NODE (user_data)->valid_have_rect = FALSE;
+ return TRUE;
+}
+
static void
property_changed (GObject *gobject,
@@ -1102,6 +1114,7 @@
g_free (output_dest_pad);
}
+ g_signal_connect (G_OBJECT (operation), "notify", G_CALLBACK (invalidate_have_rect), self);
g_signal_connect (G_OBJECT (operation), "notify", G_CALLBACK (property_changed), self);
property_changed (G_OBJECT (operation), (GParamSpec *) self, self);
}
@@ -1484,6 +1497,10 @@
if (!root)
return dummy;
+
+ if (root->valid_have_rect)
+ return root->have_rect;
+
pad = gegl_node_get_pad (root, "output");
if (pad && pad->node != root)
{
@@ -1513,6 +1530,7 @@
g_object_unref (root);
g_free (id);
+ root->valid_have_rect = TRUE;
return root->have_rect;
}
@@ -1563,8 +1581,8 @@
g_value_unset (&value);
}
- gegl_operation_context_set_result_rect (context, defined.x, defined.y, defined.width, defined.h);
- gegl_operation_process (self->operation, &defined, "foo");
+ gegl_operation_context_set_result_rect (context, &defined);
+ gegl_operation_process (self->operation, context, "output", &defined);
gegl_node_remove_context (self, &defined);
g_object_unref (buffer);
}
Modified: trunk/gegl/graph/gegl-node.h
==============================================================================
--- trunk/gegl/graph/gegl-node.h (original)
+++ trunk/gegl/graph/gegl-node.h Sat Nov 15 00:54:42 2008
@@ -45,6 +45,9 @@
GeglOperation *operation;
GeglRectangle have_rect;
+ gboolean valid_have_rect; /* <- if TRUE the above have_rect is correct
+ and can be returned directly instead of
+ computed */
GSList *pads;
GSList *input_pads;
GSList *output_pads;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]