emit "update" signals from the drawable before and after setting tiles and
2004-03-15 Michael Natterer <mitch@gimp.org> * app/core/gimpdrawable.c (gimp_drawable_set_tiles_full): emit "update" signals from the drawable before and after setting tiles and offsets. * app/core/gimpdrawable-offset.c (gimp_drawable_offset) * app/core/gimpdrawable-transform.c (gimp_drawable_transform_paste) * app/core/gimpimage-undo-push.c (undo_pop_layer_mod, _channel_mod) * app/text/gimptextlayer.c (gimp_text_layer_render) * app/tools/gimptransformtool.c (gimp_transform_tool_doit): removed calls to gimp_drawable_update(). * app/core/gimpdrawable-offset.c (gimp_drawable_offset): don't push an undo step before calling gimp_drawable_set_tiles() but simply pass push_undo == TRUE and the undo_desc.
This commit is contained in:
committed by
Michael Natterer
parent
1ef5fa93ca
commit
59b77c35c2
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2004-03-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpdrawable.c (gimp_drawable_set_tiles_full): emit
|
||||
"update" signals from the drawable before and after setting tiles
|
||||
and offsets.
|
||||
|
||||
* app/core/gimpdrawable-offset.c (gimp_drawable_offset)
|
||||
* app/core/gimpdrawable-transform.c (gimp_drawable_transform_paste)
|
||||
* app/core/gimpimage-undo-push.c (undo_pop_layer_mod, _channel_mod)
|
||||
* app/text/gimptextlayer.c (gimp_text_layer_render)
|
||||
* app/tools/gimptransformtool.c (gimp_transform_tool_doit):
|
||||
removed calls to gimp_drawable_update().
|
||||
|
||||
* app/core/gimpdrawable-offset.c (gimp_drawable_offset): don't
|
||||
push an undo step before calling gimp_drawable_set_tiles()
|
||||
but simply pass push_undo == TRUE and the undo_desc.
|
||||
|
||||
2004-03-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpdrawable.[ch]: added "offset_x" and "offset_y"
|
||||
|
||||
@ -1098,12 +1098,6 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
|
||||
if (floating_layer)
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
gimp_image_update (gimage,
|
||||
GIMP_ITEM (drawable)->offset_x,
|
||||
GIMP_ITEM (drawable)->offset_y,
|
||||
GIMP_ITEM (drawable)->width,
|
||||
GIMP_ITEM (drawable)->height);
|
||||
|
||||
tile_manager_get_offsets (tiles, &offset_x, &offset_y);
|
||||
|
||||
gimp_drawable_set_tiles_full (drawable, TRUE, undo_desc,
|
||||
@ -1112,11 +1106,6 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gimp_drawable_update (drawable,
|
||||
0, 0,
|
||||
gimp_item_width (GIMP_ITEM (drawable)),
|
||||
gimp_item_height (GIMP_ITEM (drawable)));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -313,21 +313,6 @@ gimp_drawable_offset (GimpDrawable *drawable,
|
||||
}
|
||||
}
|
||||
|
||||
/* push an undo */
|
||||
gimp_drawable_push_undo (drawable, _("Offset Drawable"),
|
||||
0, 0,
|
||||
gimp_item_width (item),
|
||||
gimp_item_height (item),
|
||||
gimp_drawable_data (drawable),
|
||||
FALSE);
|
||||
|
||||
/* set the tiles */
|
||||
gimp_drawable_set_tiles (drawable, FALSE, NULL, new_tiles);
|
||||
gimp_drawable_set_tiles (drawable, TRUE, _("Offset Drawable"), new_tiles);
|
||||
tile_manager_unref (new_tiles);
|
||||
|
||||
/* update the drawable */
|
||||
gimp_drawable_update (drawable,
|
||||
0, 0,
|
||||
gimp_item_width (item),
|
||||
gimp_item_height (item));
|
||||
}
|
||||
|
||||
@ -1098,12 +1098,6 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
|
||||
if (floating_layer)
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
gimp_image_update (gimage,
|
||||
GIMP_ITEM (drawable)->offset_x,
|
||||
GIMP_ITEM (drawable)->offset_y,
|
||||
GIMP_ITEM (drawable)->width,
|
||||
GIMP_ITEM (drawable)->height);
|
||||
|
||||
tile_manager_get_offsets (tiles, &offset_x, &offset_y);
|
||||
|
||||
gimp_drawable_set_tiles_full (drawable, TRUE, undo_desc,
|
||||
@ -1112,11 +1106,6 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gimp_drawable_update (drawable,
|
||||
0, 0,
|
||||
gimp_item_width (GIMP_ITEM (drawable)),
|
||||
gimp_item_height (GIMP_ITEM (drawable)));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -350,28 +350,17 @@ gimp_drawable_scale (GimpItem *item,
|
||||
GimpProgressFunc progress_callback,
|
||||
gpointer progress_data)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (item);
|
||||
PixelRegion srcPR, destPR;
|
||||
TileManager *new_tiles;
|
||||
|
||||
drawable = GIMP_DRAWABLE (item);
|
||||
|
||||
/* Update the old position */
|
||||
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
|
||||
|
||||
/* Allocate the new channel */
|
||||
new_tiles = tile_manager_new (new_width, new_height, drawable->bytes);
|
||||
|
||||
/* Configure the pixel regions */
|
||||
pixel_region_init (&srcPR, drawable->tiles,
|
||||
0, 0,
|
||||
item->width,
|
||||
item->height,
|
||||
0, 0, item->width, item->height,
|
||||
FALSE);
|
||||
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
0, 0,
|
||||
new_width, new_height,
|
||||
0, 0, new_width, new_height,
|
||||
TRUE);
|
||||
|
||||
/* Scale the drawable -
|
||||
@ -388,9 +377,6 @@ gimp_drawable_scale (GimpItem *item,
|
||||
new_tiles, gimp_drawable_type (drawable),
|
||||
new_offset_x, new_offset_y);
|
||||
tile_manager_unref (new_tiles);
|
||||
|
||||
/* Update the new position */
|
||||
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -400,7 +386,7 @@ gimp_drawable_resize (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (item);
|
||||
PixelRegion srcPR, destPR;
|
||||
TileManager *new_tiles;
|
||||
gint new_offset_x;
|
||||
@ -420,12 +406,7 @@ gimp_drawable_resize (GimpItem *item,
|
||||
©_x, ©_y,
|
||||
©_width, ©_height);
|
||||
|
||||
/* Update the old position */
|
||||
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
|
||||
|
||||
/* Allocate the new tile manager, configure dest region */
|
||||
new_tiles = tile_manager_new (new_width, new_height,
|
||||
drawable->bytes);
|
||||
new_tiles = tile_manager_new (new_width, new_height, drawable->bytes);
|
||||
|
||||
/* Determine whether the new tiles need to be initially cleared */
|
||||
if (copy_width != new_width ||
|
||||
@ -462,12 +443,8 @@ gimp_drawable_resize (GimpItem *item,
|
||||
|
||||
gimp_drawable_set_tiles_full (drawable, FALSE, NULL,
|
||||
new_tiles, gimp_drawable_type (drawable),
|
||||
item->offset_x - offset_x,
|
||||
item->offset_y - offset_y);
|
||||
new_offset_x, new_offset_y);
|
||||
tile_manager_unref (new_tiles);
|
||||
|
||||
/* update the new area */
|
||||
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -841,13 +818,27 @@ gimp_drawable_set_tiles_full (GimpDrawable *drawable,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
{
|
||||
GimpItem *item;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (tiles != NULL);
|
||||
|
||||
item = GIMP_ITEM (drawable);
|
||||
|
||||
if (item->width != tile_manager_width (tiles) ||
|
||||
item->height != tile_manager_height (tiles) ||
|
||||
item->offset_x != offset_x ||
|
||||
item->offset_y != offset_y)
|
||||
{
|
||||
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
|
||||
}
|
||||
|
||||
GIMP_DRAWABLE_GET_CLASS (drawable)->set_tiles (drawable,
|
||||
push_undo, undo_desc,
|
||||
tiles, type,
|
||||
offset_x, offset_y);
|
||||
|
||||
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -1391,12 +1391,6 @@ undo_pop_layer_mod (GimpUndo *undo,
|
||||
gint offset_x, offset_y;
|
||||
TileManager *tiles;
|
||||
|
||||
/* Issue the first update */
|
||||
gimp_drawable_update (GIMP_DRAWABLE (layer),
|
||||
0, 0,
|
||||
GIMP_ITEM (layer)->width,
|
||||
GIMP_ITEM (layer)->height);
|
||||
|
||||
tiles = lmu->tiles;
|
||||
layer_type = lmu->type;
|
||||
offset_x = lmu->offset_x;
|
||||
@ -1411,12 +1405,6 @@ undo_pop_layer_mod (GimpUndo *undo,
|
||||
tiles, layer_type, offset_x, offset_y);
|
||||
tile_manager_unref (tiles);
|
||||
|
||||
/* Issue the second update */
|
||||
gimp_drawable_update (GIMP_DRAWABLE (layer),
|
||||
0, 0,
|
||||
GIMP_ITEM (layer)->width,
|
||||
GIMP_ITEM (layer)->height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2045,12 +2033,6 @@ undo_pop_channel_mod (GimpUndo *undo,
|
||||
GimpChannel *channel = GIMP_CHANNEL (GIMP_ITEM_UNDO (undo)->item);
|
||||
TileManager *tiles;
|
||||
|
||||
/* Issue the first update */
|
||||
gimp_drawable_update (GIMP_DRAWABLE (channel),
|
||||
0, 0,
|
||||
GIMP_ITEM (channel)->width,
|
||||
GIMP_ITEM (channel)->height);
|
||||
|
||||
tiles = cmu->tiles;
|
||||
|
||||
cmu->tiles = tile_manager_ref (GIMP_DRAWABLE (channel)->tiles);
|
||||
@ -2058,12 +2040,6 @@ undo_pop_channel_mod (GimpUndo *undo,
|
||||
gimp_drawable_set_tiles (GIMP_DRAWABLE (channel), FALSE, NULL, tiles);
|
||||
tile_manager_unref (tiles);
|
||||
|
||||
/* Issue the second update */
|
||||
gimp_drawable_update (GIMP_DRAWABLE (channel),
|
||||
0, 0,
|
||||
GIMP_ITEM (channel)->width,
|
||||
GIMP_ITEM (channel)->height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -481,33 +481,15 @@ gimp_text_layer_render (GimpTextLayer *layer)
|
||||
|
||||
layout = gimp_text_layout_new (layer->text, image);
|
||||
|
||||
if (gimp_text_layout_get_size (layout, &width, &height))
|
||||
if (gimp_text_layout_get_size (layout, &width, &height) &&
|
||||
(width != gimp_item_width (item) ||
|
||||
height != gimp_item_height (item)))
|
||||
{
|
||||
if (width != gimp_item_width (item) ||
|
||||
height != gimp_item_height (item))
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
TileManager *new_tiles = tile_manager_new (width, height,
|
||||
drawable->bytes);
|
||||
|
||||
gimp_drawable_update (drawable,
|
||||
0, 0,
|
||||
gimp_item_width (item),
|
||||
gimp_item_height (item));
|
||||
|
||||
GIMP_ITEM (drawable)->width = width;
|
||||
GIMP_ITEM (drawable)->height = height;
|
||||
|
||||
new_tiles = tile_manager_new (width, height, drawable->bytes);
|
||||
|
||||
gimp_drawable_set_tiles (drawable, FALSE, NULL, new_tiles);
|
||||
tile_manager_unref (new_tiles);
|
||||
|
||||
gimp_drawable_update (drawable,
|
||||
0, 0,
|
||||
gimp_item_width (item),
|
||||
gimp_item_height (item));
|
||||
|
||||
gimp_viewable_size_changed (GIMP_VIEWABLE (layer));
|
||||
}
|
||||
gimp_drawable_set_tiles (drawable, FALSE, NULL, new_tiles);
|
||||
tile_manager_unref (new_tiles);
|
||||
}
|
||||
|
||||
if (layer->auto_rename)
|
||||
|
||||
@ -985,11 +985,6 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
|
||||
|
||||
gimp_drawable_set_tiles (drawable, FALSE, NULL, new_tiles);
|
||||
tile_manager_unref (new_tiles);
|
||||
|
||||
gimp_drawable_update (GIMP_DRAWABLE (active_item),
|
||||
0, 0,
|
||||
gimp_item_width (active_item),
|
||||
gimp_item_height (active_item));
|
||||
}
|
||||
|
||||
tile_manager_unref (tr_tool->original);
|
||||
|
||||
Reference in New Issue
Block a user