Use gimp_image_set_size() instead of setting width and height manually

This also (really this time) fixes nested group layers. There were
cases when the outer group layer didn't properly resize itself because
gimp_drawable_set_tiles() on the inner group layer failed to emit
notify::width and notify::height.
This commit is contained in:
Michael Natterer 2009-08-26 13:03:40 +02:00
parent ce5d591336
commit ea33581451
5 changed files with 15 additions and 23 deletions

View File

@ -756,15 +756,9 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
gimp_item_set_offset (item, offset_x, offset_y);
if (gimp_item_get_width (item) != tile_manager_width (tiles) ||
gimp_item_get_height (item) != tile_manager_height (tiles))
{
item->width = tile_manager_width (tiles);
item->height = tile_manager_height (tiles);
gimp_viewable_size_changed (GIMP_VIEWABLE (drawable));
}
gimp_item_set_size (item,
tile_manager_width (tiles),
tile_manager_height (tiles));
if (old_has_alpha != gimp_drawable_has_alpha (drawable))
gimp_drawable_alpha_changed (drawable);

View File

@ -139,13 +139,8 @@ gimp_image_rotate (GimpImage *image,
gimp_item_rotate (item, context, rotate_type, center_x, center_y, FALSE);
item->width = new_image_width;
item->height = new_image_height;
g_object_notify (G_OBJECT (item), "width");
g_object_notify (G_OBJECT (item), "height");
gimp_item_set_offset (item, 0, 0);
gimp_item_set_size (item, new_image_width, new_image_height);
gimp_item_translate (item,
(new_image_width - gimp_image_get_width (image)) / 2,

View File

@ -207,12 +207,13 @@ gimp_text_layer_from_layer (GimpLayer *layer,
item->parasites = GIMP_ITEM (layer)->parasites;
GIMP_ITEM (layer)->parasites = NULL;
item->width = gimp_item_get_width (GIMP_ITEM (layer));
item->height = gimp_item_get_height (GIMP_ITEM (layer));
gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
gimp_item_set_offset (item, offset_x, offset_y);
gimp_item_set_size (item,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)));
gimp_item_set_visible (item, gimp_item_get_visible (GIMP_ITEM (layer)), FALSE);
gimp_item_set_linked (item, gimp_item_get_linked (GIMP_ITEM (layer)), FALSE);

View File

@ -310,8 +310,9 @@ static void
gimp_vectors_convert (GimpItem *item,
GimpImage *dest_image)
{
item->width = gimp_image_get_width (dest_image);
item->height = gimp_image_get_height (dest_image);
gimp_item_set_size (item,
gimp_image_get_width (dest_image),
gimp_image_get_height (dest_image));
GIMP_ITEM_CLASS (parent_class)->convert (item, dest_image);
}

View File

@ -125,12 +125,13 @@ gimp_vectors_mod_undo_pop (GimpUndo *undo,
gimp_vectors_copy_strokes (temp, vectors);
GIMP_ITEM (vectors)->width = gimp_item_get_width (GIMP_ITEM (temp));
GIMP_ITEM (vectors)->height = gimp_item_get_height (GIMP_ITEM (temp));
gimp_item_get_offset (GIMP_ITEM (temp), &offset_x, &offset_y);
gimp_item_set_offset (GIMP_ITEM (vectors), offset_x, offset_y);
gimp_item_set_size (GIMP_ITEM (vectors),
gimp_item_get_width (GIMP_ITEM (temp)),
gimp_item_get_height (GIMP_ITEM (temp)));
g_object_unref (temp);
gimp_vectors_thaw (vectors);