mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 12:02:32 +00:00
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:
parent
8c8d3786d9
commit
4625597ab8
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2007-06-27 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
Removed useless image flushing which caused the image preview to
|
Removed useless image flushing which caused the image preview to
|
||||||
|
|
|
@ -414,17 +414,18 @@ gimp_image_map_clear (GimpImageMap *image_map)
|
||||||
/* restore the original image */
|
/* restore the original image */
|
||||||
if (image_map->undo_tiles)
|
if (image_map->undo_tiles)
|
||||||
{
|
{
|
||||||
PixelRegion srcPR, destPR;
|
PixelRegion srcPR;
|
||||||
gint offset_x = image_map->undo_offset_x;
|
PixelRegion destPR;
|
||||||
gint offset_y = image_map->undo_offset_y;
|
gint x = image_map->undo_offset_x;
|
||||||
gint width = tile_manager_width (image_map->undo_tiles);
|
gint y = image_map->undo_offset_y;
|
||||||
gint height = tile_manager_height (image_map->undo_tiles);
|
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 */
|
/* Copy from the drawable to the tiles */
|
||||||
pixel_region_init (&srcPR, image_map->undo_tiles,
|
pixel_region_init (&srcPR, image_map->undo_tiles,
|
||||||
0, 0, width, height, FALSE);
|
0, 0, width, height, FALSE);
|
||||||
pixel_region_init (&destPR, gimp_drawable_get_tiles (image_map->drawable),
|
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 the user has changed the image depth get out quickly */
|
||||||
if (destPR.bytes != srcPR.bytes)
|
if (destPR.bytes != srcPR.bytes)
|
||||||
|
@ -433,11 +434,20 @@ gimp_image_map_clear (GimpImageMap *image_map)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GimpImage *image;
|
||||||
|
gint off_x, off_y;
|
||||||
|
|
||||||
copy_region (&srcPR, &destPR);
|
copy_region (&srcPR, &destPR);
|
||||||
|
|
||||||
/* Update the area */
|
image = gimp_item_get_image (GIMP_ITEM (image_map->drawable));
|
||||||
gimp_drawable_update (image_map->drawable,
|
|
||||||
offset_x, offset_y, width, height);
|
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 */
|
/* Free the undo_tiles tile manager */
|
||||||
|
@ -464,6 +474,7 @@ static gboolean
|
||||||
gimp_image_map_do (GimpImageMap *image_map)
|
gimp_image_map_do (GimpImageMap *image_map)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
|
gint off_x, off_y;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
if (! gimp_item_is_attached (GIMP_ITEM (image_map->drawable)))
|
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));
|
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
|
/* Process up to 16 tiles in one go. This reduces the overhead
|
||||||
* caused by updating the display while the imagemap is being
|
* caused by updating the display while the imagemap is being
|
||||||
* applied and gives us a tiny speedup.
|
* applied and gives us a tiny speedup.
|
||||||
|
@ -512,7 +525,11 @@ gimp_image_map_do (GimpImageMap *image_map)
|
||||||
NULL,
|
NULL,
|
||||||
x, y);
|
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);
|
image_map->PRI = pixel_regions_process (image_map->PRI);
|
||||||
|
|
||||||
|
|
|
@ -788,11 +788,13 @@ gimp_paint_core_paste (GimpPaintCore *core,
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
PixelRegion srcPR;
|
PixelRegion srcPR;
|
||||||
TileManager *alt = NULL;
|
TileManager *alt = NULL;
|
||||||
gint offx;
|
gint off_x;
|
||||||
gint offy;
|
gint off_y;
|
||||||
|
|
||||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||||
|
|
||||||
|
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
|
||||||
|
|
||||||
/* set undo blocks */
|
/* set undo blocks */
|
||||||
gimp_paint_core_validate_undo_tiles (core, drawable,
|
gimp_paint_core_validate_undo_tiles (core, drawable,
|
||||||
core->canvas_buf->x,
|
core->canvas_buf->x,
|
||||||
|
@ -803,10 +805,6 @@ gimp_paint_core_paste (GimpPaintCore *core,
|
||||||
if (core->use_saved_proj)
|
if (core->use_saved_proj)
|
||||||
{
|
{
|
||||||
GimpPickable *pickable = GIMP_PICKABLE (image->projection);
|
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,
|
gimp_paint_core_validate_saved_proj_tiles (core, pickable,
|
||||||
core->canvas_buf->x + off_x,
|
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()
|
/* Update the image -- It is important to call gimp_image_update()
|
||||||
* instead of gimp_drawable_update() because we don't want the
|
* 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,
|
gimp_image_update (image,
|
||||||
core->canvas_buf->x + offx,
|
core->canvas_buf->x + off_x,
|
||||||
core->canvas_buf->y + offy,
|
core->canvas_buf->y + off_y,
|
||||||
core->canvas_buf->width,
|
core->canvas_buf->width,
|
||||||
core->canvas_buf->height);
|
core->canvas_buf->height);
|
||||||
}
|
}
|
||||||
|
@ -896,8 +893,8 @@ gimp_paint_core_replace (GimpPaintCore *core,
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
PixelRegion srcPR;
|
PixelRegion srcPR;
|
||||||
gint offx;
|
gint off_x;
|
||||||
gint offy;
|
gint off_y;
|
||||||
|
|
||||||
if (! gimp_drawable_has_alpha (drawable))
|
if (! gimp_drawable_has_alpha (drawable))
|
||||||
{
|
{
|
||||||
|
@ -910,6 +907,8 @@ gimp_paint_core_replace (GimpPaintCore *core,
|
||||||
|
|
||||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||||
|
|
||||||
|
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
|
||||||
|
|
||||||
/* set undo blocks */
|
/* set undo blocks */
|
||||||
gimp_paint_core_validate_undo_tiles (core, drawable,
|
gimp_paint_core_validate_undo_tiles (core, drawable,
|
||||||
core->canvas_buf->x,
|
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()
|
/* Update the image -- It is important to call gimp_image_update()
|
||||||
* instead of gimp_drawable_update() because we don't want the
|
* 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,
|
gimp_image_update (image,
|
||||||
core->canvas_buf->x + offx,
|
core->canvas_buf->x + off_x,
|
||||||
core->canvas_buf->y + offy,
|
core->canvas_buf->y + off_y,
|
||||||
core->canvas_buf->width,
|
core->canvas_buf->width,
|
||||||
core->canvas_buf->height);
|
core->canvas_buf->height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,6 +487,7 @@ gimp_image_map_tool_response (GtkWidget *widget,
|
||||||
|
|
||||||
gimp_tool_control_set_preserve (tool->control, FALSE);
|
gimp_tool_control_set_preserve (tool->control, FALSE);
|
||||||
|
|
||||||
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_map_tool->drawable));
|
||||||
gimp_image_flush (tool->display->image);
|
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_tool_control_set_preserve (tool->control, FALSE);
|
||||||
|
|
||||||
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_map_tool->drawable));
|
||||||
gimp_image_flush (tool->display->image);
|
gimp_image_flush (tool->display->image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue