Commit 594bc84a authored by Martin Nordholts's avatar Martin Nordholts
Browse files

New function that sets the offset of the item and also keeps the

* app/core/gimpitem.c (gimp_item_set_offsets): New function that
sets the offset of the item and also keeps the offset_node in
sync.

* app/core/gimpdrawable.c (gimp_drawable_real_set_tiles): Use the
function instead of setting the offsets directly. Fixes corrupted
display when cropping images with GEGL enabled for the projection.

svn path=/trunk/; revision=27528
parent 93577a2e
2008-11-02 Martin Nordholts <martinn@svn.gnome.org>
* app/core/gimpitem.c (gimp_item_set_offsets): New function that
sets the offset of the item and also keeps the offset_node in
sync.
* app/core/gimpdrawable.c (gimp_drawable_real_set_tiles): Use the
function instead of setting the offsets directly. Fixes corrupted
display when cropping images with GEGL enabled for the projection.
2008-11-02 Martin Nordholts <martinn@svn.gnome.org>
* app/core/gimpitem.[ch]: Moved the shift_node from GimpLayer to
......
......@@ -748,8 +748,7 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
drawable->bytes = tile_manager_bpp (tiles);
drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
item->offset_x = offset_x;
item->offset_y = offset_y;
gimp_item_set_offsets (item, offset_x, offset_y);
if (gimp_item_width (item) != tile_manager_width (tiles) ||
gimp_item_height (item) != tile_manager_height (tiles))
......
......@@ -106,6 +106,7 @@ static void gimp_item_real_resize (GimpItem *item,
gint offset_x,
gint offset_y);
static GeglNode * gimp_item_real_get_node (GimpItem *item);
static void gimp_item_sync_offset_node (GimpItem *item);
G_DEFINE_TYPE (GimpItem, gimp_item, GIMP_TYPE_VIEWABLE)
......@@ -410,11 +411,7 @@ gimp_item_real_translate (GimpItem *item,
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);
gimp_item_sync_offset_node (item);
}
static void
......@@ -465,6 +462,16 @@ gimp_item_real_get_node (GimpItem *item)
return item->node;
}
static void
gimp_item_sync_offset_node (GimpItem *item)
{
if (item->offset_node)
gegl_node_set (item->offset_node,
"x", (gdouble) item->offset_x,
"y", (gdouble) item->offset_y,
NULL);
}
/**
* gimp_item_remove:
* @item: the #GimpItem to remove.
......@@ -704,6 +711,19 @@ gimp_item_offsets (const GimpItem *item,
if (offset_y) *offset_y = item->offset_y;
}
void
gimp_item_set_offsets (GimpItem *item,
gint offset_x,
gint offset_y)
{
g_return_if_fail (GIMP_IS_ITEM (item));
item->offset_x = offset_x;
item->offset_y = offset_y;
gimp_item_sync_offset_node (item);
}
/**
* gimp_item_translate:
* @item: The #GimpItem to move.
......
......@@ -162,6 +162,9 @@ gint gimp_item_height (const GimpItem *item);
void gimp_item_offsets (const GimpItem *item,
gint *offset_x,
gint *offset_y);
void gimp_item_set_offsets (GimpItem *item,
gint offset_x,
gint offset_y);
void gimp_item_translate (GimpItem *item,
gint offset_x,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment