[gimp/soc-2011-seamless-clone2] app: allow a NULL src_buffer in gimp_gegl_apply_operation()
- From: Clayton Walker <claytonw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2011-seamless-clone2] app: allow a NULL src_buffer in gimp_gegl_apply_operation()
- Date: Wed, 8 May 2013 15:18:15 +0000 (UTC)
commit ca34e26570c63bbd2eb482af8043e8e58ccd9cae
Author: Michael Natterer <mitch gimp org>
Date: Mon Apr 22 10:55:09 2013 +0200
app: allow a NULL src_buffer in gimp_gegl_apply_operation()
in which case the function just does nothing on the passed operation's
input and expects it to be already conntected to something. Also allow
to pass an operation that is already part of another graph.
app/gegl/gimp-gegl-apply-operation.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-apply-operation.c b/app/gegl/gimp-gegl-apply-operation.c
index 3f18b89..09b09f7 100644
--- a/app/gegl/gimp-gegl-apply-operation.c
+++ b/app/gegl/gimp-gegl-apply-operation.c
@@ -43,13 +43,12 @@ gimp_gegl_apply_operation (GeglBuffer *src_buffer,
const GeglRectangle *dest_rect)
{
GeglNode *gegl;
- GeglNode *src_node;
GeglNode *dest_node;
GeglRectangle rect = { 0, };
gdouble value;
gboolean progress_active = FALSE;
- g_return_if_fail (GEGL_IS_BUFFER (src_buffer));
+ g_return_if_fail (src_buffer == NULL || GEGL_IS_BUFFER (src_buffer));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
g_return_if_fail (GEGL_IS_NODE (operation));
g_return_if_fail (GEGL_IS_BUFFER (dest_buffer));
@@ -66,18 +65,30 @@ gimp_gegl_apply_operation (GeglBuffer *src_buffer,
gegl = gegl_node_new ();
- src_node = gegl_node_new_child (gegl,
- "operation", "gegl:buffer-source",
- "buffer", src_buffer,
- NULL);
+ if (! gegl_node_get_parent (operation))
+ gegl_node_add_child (gegl, operation);
+
+ if (src_buffer)
+ {
+ GeglNode *src_node;
+
+ src_node = gegl_node_new_child (gegl,
+ "operation", "gegl:buffer-source",
+ "buffer", src_buffer,
+ NULL);
+
+ gegl_node_connect_to (src_node, "output",
+ operation, "input");
+ }
+
dest_node = gegl_node_new_child (gegl,
"operation", "gegl:write-buffer",
"buffer", dest_buffer,
NULL);
- gegl_node_add_child (gegl, operation);
- gegl_node_link_many (src_node, operation, dest_node, NULL);
+ gegl_node_connect_to (operation, "output",
+ dest_node, "input");
if (progress)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]