gimp r27527 - in trunk: . app/core
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27527 - in trunk: . app/core
- Date: Sun, 2 Nov 2008 22:29:06 +0000 (UTC)
Author: martinn
Date: Sun Nov 2 22:29:05 2008
New Revision: 27527
URL: http://svn.gnome.org/viewvc/gimp?rev=27527&view=rev
Log:
* app/core/gimpitem.[ch]: Moved the shift_node from GimpLayer to
GimpItem, and call it offset_node. Also added
gimp_item_get_offset_node() meant to be used in the same way as
gimp_item_offsets().
(gimp_item_real_translate): Keep the offset_node up to date.
* app/core/gimplayer.[ch]: Don't manage the offset_node, get it
from GimpItem instead.
Modified:
trunk/ChangeLog
trunk/app/core/gimpitem.c
trunk/app/core/gimpitem.h
trunk/app/core/gimplayer.c
trunk/app/core/gimplayer.h
Modified: trunk/app/core/gimpitem.c
==============================================================================
--- trunk/app/core/gimpitem.c (original)
+++ trunk/app/core/gimpitem.c Sun Nov 2 22:29:05 2008
@@ -205,18 +205,19 @@
{
g_object_force_floating (G_OBJECT (item));
- item->ID = 0;
- item->tattoo = 0;
- item->image = NULL;
- item->parasites = gimp_parasite_list_new ();
- item->width = 0;
- item->height = 0;
- item->offset_x = 0;
- item->offset_y = 0;
- item->visible = TRUE;
- item->linked = FALSE;
- item->removed = FALSE;
- item->node = NULL;
+ item->ID = 0;
+ item->tattoo = 0;
+ item->image = NULL;
+ item->parasites = gimp_parasite_list_new ();
+ item->width = 0;
+ item->height = 0;
+ item->offset_x = 0;
+ item->offset_y = 0;
+ item->visible = TRUE;
+ item->linked = FALSE;
+ item->removed = FALSE;
+ item->node = NULL;
+ item->offset_node = NULL;
}
static void
@@ -408,6 +409,12 @@
{
item->offset_x += offset_x;
item->offset_y += offset_y;
+
+ if (item->offset_node)
+ gegl_node_set (item->offset_node,
+ "x", (gdouble) item->offset_x,
+ "y", (gdouble) item->offset_y,
+ NULL);
}
static void
@@ -450,6 +457,11 @@
{
item->node = gegl_node_new ();
+ item->offset_node = gegl_node_new_child (item->node,
+ "operation", "gegl:shift",
+ "x", (gdouble) item->offset_x,
+ "y", (gdouble) item->offset_y,
+ NULL);
return item->node;
}
@@ -1103,6 +1115,17 @@
return GIMP_ITEM_GET_CLASS (item)->get_node (item);
}
+GeglNode *
+gimp_item_get_offset_node (GimpItem *item)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
+
+ if (! item->offset_node)
+ gimp_item_get_node (item);
+
+ return item->offset_node;
+}
+
gint
gimp_item_get_ID (GimpItem *item)
{
Modified: trunk/app/core/gimpitem.h
==============================================================================
--- trunk/app/core/gimpitem.h (original)
+++ trunk/app/core/gimpitem.h Sun Nov 2 22:29:05 2008
@@ -54,6 +54,7 @@
GeglNode *node; /* the GEGL node to plug
into the graph */
+ GeglNode *offset_node; /* the offset as a node */
};
struct _GimpItemClass
@@ -226,6 +227,7 @@
GError **error);
GeglNode * gimp_item_get_node (GimpItem *item);
+GeglNode * gimp_item_get_offset_node (GimpItem *item);
gint gimp_item_get_ID (GimpItem *item);
Modified: trunk/app/core/gimplayer.c
==============================================================================
--- trunk/app/core/gimplayer.c (original)
+++ trunk/app/core/gimplayer.c Sun Nov 2 22:29:05 2008
@@ -514,9 +514,9 @@
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GimpLayer *layer = GIMP_LAYER (item);
GeglNode *node;
+ GeglNode *offset_node;
GeglNode *source;
GeglNode *mode_node;
- gint off_x, off_y;
node = GIMP_ITEM_CLASS (parent_class)->get_node (item);
@@ -540,15 +540,10 @@
layer->opacity_node, "aux");
}
- gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
- layer->shift_node = gegl_node_new_child (node,
- "operation", "gegl:shift",
- "x", (gdouble) off_x,
- "y", (gdouble) off_y,
- NULL);
+ offset_node = gimp_item_get_offset_node (GIMP_ITEM (layer));
gegl_node_connect_to (layer->opacity_node, "output",
- layer->shift_node, "input");
+ offset_node, "input");
mode_node = gimp_drawable_get_mode_node (drawable);
@@ -557,8 +552,8 @@
"blend-mode", layer->mode,
NULL);
- gegl_node_connect_to (layer->shift_node, "output",
- mode_node, "aux");
+ gegl_node_connect_to (offset_node, "output",
+ mode_node, "aux");
return node;
}
@@ -765,12 +760,6 @@
if (gimp_layer_is_floating_sel (layer))
floating_sel_rigor (layer, FALSE);
- if (layer->shift_node)
- gegl_node_set (layer->shift_node,
- "x", (gdouble) item->offset_x,
- "y", (gdouble) item->offset_y,
- NULL);
-
/* update the new region */
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
@@ -1992,7 +1981,7 @@
g_signal_emit (layer, layer_signals[MODE_CHANGED], 0);
g_object_notify (G_OBJECT (layer), "mode");
- if (layer->shift_node)
+ if (layer->opacity_node)
{
GeglNode *mode_node;
Modified: trunk/app/core/gimplayer.h
==============================================================================
--- trunk/app/core/gimplayer.h (original)
+++ trunk/app/core/gimplayer.h Sun Nov 2 22:29:05 2008
@@ -43,7 +43,6 @@
GimpLayerMask *mask; /* possible layer mask */
- GeglNode *shift_node;
GeglNode *opacity_node;
/* Floating selections */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]