[gimp] Fix the layer-offset of the group layer's projection graph
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Fix the layer-offset of the group layer's projection graph
- Date: Mon, 24 Aug 2009 20:03:08 +0000 (UTC)
commit 1403db11efe490f4b95efd7dad77d3c3b04cf217
Author: Michael Natterer <mitch gimp org>
Date: Mon Aug 24 22:01:16 2009 +0200
Fix the layer-offset of the group layer's projection graph
Insert a gegl:translate node into the group layer's projection
graph. Produces identical results as the legacy projection now, but is
not yet switched on by checking View->Use Gegl.
app/core/gimpgrouplayer.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
app/core/gimpgrouplayer.h | 2 ++
2 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 4cdd79e..12f7912 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -291,6 +291,12 @@ gimp_group_layer_finalize (GObject *object)
group->projection = NULL;
}
+ if (group->graph)
+ {
+ g_object_unref (group->graph);
+ group->graph = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -526,8 +532,38 @@ static GeglNode *
gimp_group_layer_get_graph (GimpProjectable *projectable)
{
GimpGroupLayer *group = GIMP_GROUP_LAYER (projectable);
+ GeglNode *layers_node;
+ GeglNode *output;
+ gint off_x;
+ gint off_y;
+
+ if (group->graph)
+ return group->graph;
+
+ group->graph = gegl_node_new ();
+
+ layers_node =
+ gimp_drawable_stack_get_graph (GIMP_DRAWABLE_STACK (group->children));
+
+ gegl_node_add_child (group->graph, layers_node);
- return gimp_drawable_stack_get_graph (GIMP_DRAWABLE_STACK (group->children));
+ gimp_item_get_offset (GIMP_ITEM (group), &off_x, &off_y);
+
+ group->offset_node = gegl_node_new_child (group->graph,
+ "operation", "gegl:translate",
+ "x", (gdouble) -off_x,
+ "y", (gdouble) -off_y,
+ NULL);
+
+ gegl_node_connect_to (layers_node, "output",
+ group->offset_node, "input");
+
+ output = gegl_node_get_output_proxy (group->graph, "output");
+
+ gegl_node_connect_to (group->offset_node, "output",
+ output, "input");
+
+ return group->graph;
}
static GList *
@@ -657,6 +693,12 @@ gimp_group_layer_update_size (GimpGroupLayer *group)
{
gimp_item_set_offset (GIMP_ITEM (group), x, y);
}
+
+ if (group->offset_node)
+ gegl_node_set (group->offset_node,
+ "x", (gdouble) -x,
+ "y", (gdouble) -y,
+ NULL);
}
}
diff --git a/app/core/gimpgrouplayer.h b/app/core/gimpgrouplayer.h
index d14273c..2635323 100644
--- a/app/core/gimpgrouplayer.h
+++ b/app/core/gimpgrouplayer.h
@@ -41,6 +41,8 @@ struct _GimpGroupLayer
GimpContainer *children;
GimpProjection *projection;
+ GeglNode *graph;
+ GeglNode *offset_node;
};
struct _GimpGroupLayerClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]