update the image, not the drawable so we avoid constantly invalidating the

2007-06-27  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimagemap.c (gimp_image_map_clear)
	(gimp_image_map_do): update the image, not the drawable so we
	avoid constantly invalidating the drawable preview.

	* app/tools/gimpimagemaptool.c (gimp_image_map_tool_response):
	invalidate the drawable preview here.

	* app/paint/gimppaintcore.c (gimp_paint_core_paste)
	(gimp_paint_core_replace): clean up drawable offset handling code.


svn path=/trunk/; revision=22843
This commit is contained in:
Michael Natterer 2007-06-26 22:41:06 +00:00 committed by Michael Natterer
parent 8c8d3786d9
commit 4625597ab8
4 changed files with 55 additions and 26 deletions

View file

@ -1,3 +1,15 @@
2007-06-27 Michael Natterer <mitch@gimp.org>
* app/core/gimpimagemap.c (gimp_image_map_clear)
(gimp_image_map_do): update the image, not the drawable so we
avoid constantly invalidating the drawable preview.
* app/tools/gimpimagemaptool.c (gimp_image_map_tool_response):
invalidate the drawable preview here.
* app/paint/gimppaintcore.c (gimp_paint_core_paste)
(gimp_paint_core_replace): clean up drawable offset handling code.
2007-06-27 Michael Natterer <mitch@gimp.org>
Removed useless image flushing which caused the image preview to

View file

@ -414,17 +414,18 @@ gimp_image_map_clear (GimpImageMap *image_map)
/* restore the original image */
if (image_map->undo_tiles)
{
PixelRegion srcPR, destPR;
gint offset_x = image_map->undo_offset_x;
gint offset_y = image_map->undo_offset_y;
gint width = tile_manager_width (image_map->undo_tiles);
gint height = tile_manager_height (image_map->undo_tiles);
PixelRegion srcPR;
PixelRegion destPR;
gint x = image_map->undo_offset_x;
gint y = image_map->undo_offset_y;
gint width = tile_manager_width (image_map->undo_tiles);
gint height = tile_manager_height (image_map->undo_tiles);
/* Copy from the drawable to the tiles */
pixel_region_init (&srcPR, image_map->undo_tiles,
0, 0, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_tiles (image_map->drawable),
offset_x, offset_y, width, height, TRUE);
x, y, width, height, TRUE);
/* if the user has changed the image depth get out quickly */
if (destPR.bytes != srcPR.bytes)
@ -433,11 +434,20 @@ gimp_image_map_clear (GimpImageMap *image_map)
}
else
{
GimpImage *image;
gint off_x, off_y;
copy_region (&srcPR, &destPR);
/* Update the area */
gimp_drawable_update (image_map->drawable,
offset_x, offset_y, width, height);
image = gimp_item_get_image (GIMP_ITEM (image_map->drawable));
gimp_item_offsets (GIMP_ITEM (image_map->drawable), &off_x, &off_y);
/* Update the image -- It is important to call gimp_image_update()
* instead of gimp_drawable_update() because we don't want the
* drawable preview to be constantly invalidated
*/
gimp_image_update (image, x + off_x, y + off_y, width, height);
}
/* Free the undo_tiles tile manager */
@ -464,6 +474,7 @@ static gboolean
gimp_image_map_do (GimpImageMap *image_map)
{
GimpImage *image;
gint off_x, off_y;
gint i;
if (! gimp_item_is_attached (GIMP_ITEM (image_map->drawable)))
@ -475,6 +486,8 @@ gimp_image_map_do (GimpImageMap *image_map)
image = gimp_item_get_image (GIMP_ITEM (image_map->drawable));
gimp_item_offsets (GIMP_ITEM (image_map->drawable), &off_x, &off_y);
/* Process up to 16 tiles in one go. This reduces the overhead
* caused by updating the display while the imagemap is being
* applied and gives us a tiny speedup.
@ -512,7 +525,11 @@ gimp_image_map_do (GimpImageMap *image_map)
NULL,
x, y);
gimp_drawable_update (image_map->drawable, x, y, w, h);
/* Update the image -- It is important to call gimp_image_update()
* instead of gimp_drawable_update() because we don't want the
* drawable preview to be constantly invalidated
*/
gimp_image_update (image, x + off_x, y + off_y, w, h);
image_map->PRI = pixel_regions_process (image_map->PRI);

View file

@ -788,11 +788,13 @@ gimp_paint_core_paste (GimpPaintCore *core,
GimpImage *image;
PixelRegion srcPR;
TileManager *alt = NULL;
gint offx;
gint offy;
gint off_x;
gint off_y;
image = gimp_item_get_image (GIMP_ITEM (drawable));
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
/* set undo blocks */
gimp_paint_core_validate_undo_tiles (core, drawable,
core->canvas_buf->x,
@ -803,10 +805,6 @@ gimp_paint_core_paste (GimpPaintCore *core,
if (core->use_saved_proj)
{
GimpPickable *pickable = GIMP_PICKABLE (image->projection);
gint off_x;
gint off_y;
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
gimp_paint_core_validate_saved_proj_tiles (core, pickable,
core->canvas_buf->x + off_x,
@ -868,12 +866,11 @@ gimp_paint_core_paste (GimpPaintCore *core,
/* Update the image -- It is important to call gimp_image_update()
* instead of gimp_drawable_update() because we don't want the
* drawable and image previews to be constantly invalidated
* drawable preview to be constantly invalidated
*/
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
gimp_image_update (image,
core->canvas_buf->x + offx,
core->canvas_buf->y + offy,
core->canvas_buf->x + off_x,
core->canvas_buf->y + off_y,
core->canvas_buf->width,
core->canvas_buf->height);
}
@ -896,8 +893,8 @@ gimp_paint_core_replace (GimpPaintCore *core,
{
GimpImage *image;
PixelRegion srcPR;
gint offx;
gint offy;
gint off_x;
gint off_y;
if (! gimp_drawable_has_alpha (drawable))
{
@ -910,6 +907,8 @@ gimp_paint_core_replace (GimpPaintCore *core,
image = gimp_item_get_image (GIMP_ITEM (drawable));
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
/* set undo blocks */
gimp_paint_core_validate_undo_tiles (core, drawable,
core->canvas_buf->x,
@ -970,12 +969,11 @@ gimp_paint_core_replace (GimpPaintCore *core,
/* Update the image -- It is important to call gimp_image_update()
* instead of gimp_drawable_update() because we don't want the
* drawable and image previews to be constantly invalidated
* drawable preview to be constantly invalidated
*/
gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy);
gimp_image_update (image,
core->canvas_buf->x + offx,
core->canvas_buf->y + offy,
core->canvas_buf->x + off_x,
core->canvas_buf->y + off_y,
core->canvas_buf->width,
core->canvas_buf->height);
}

View file

@ -487,6 +487,7 @@ gimp_image_map_tool_response (GtkWidget *widget,
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_map_tool->drawable));
gimp_image_flush (tool->display->image);
}
@ -507,6 +508,7 @@ gimp_image_map_tool_response (GtkWidget *widget,
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_map_tool->drawable));
gimp_image_flush (tool->display->image);
}