plug-ins: use a temporary image to get the buffer...
...with filters during Recompose Previously, get_buffer_with_filters() inserted and removed a temporary copy of a layer in the original image. This caused the image to appear modified, adding entries in the undo history and prompting the user to save changes, even though the image itself was not actually changed. This patch modifies the function to create a temporary image and perform the layer insert operation there. Filters are applied as before, but the original image remains untouched, avoiding unwanted undo entries and mark the image as modified.
This commit is contained in:
parent
e18eaff1dc
commit
6e80f98390
1 changed files with 9 additions and 5 deletions
|
|
@ -862,13 +862,17 @@ static GeglBuffer *
|
|||
get_buffer_with_filters (GimpLayer *layer)
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
|
||||
GimpLayer *temp = gimp_layer_copy (layer);
|
||||
GimpImage *tmp_image;
|
||||
GimpLayer *temp;
|
||||
GeglBuffer *src_buffer;
|
||||
GeglBuffer *dst_buffer;
|
||||
|
||||
gimp_image_insert_layer (image, temp, NULL,
|
||||
gimp_image_get_item_position (image,
|
||||
GIMP_ITEM (layer)));
|
||||
tmp_image = gimp_image_new (gimp_image_get_width (image),
|
||||
gimp_image_get_height (image),
|
||||
gimp_image_get_base_type (image));
|
||||
temp = gimp_layer_new_from_drawable (GIMP_DRAWABLE (layer), tmp_image);
|
||||
|
||||
gimp_image_insert_layer (tmp_image, temp, NULL, 0);
|
||||
|
||||
gimp_drawable_merge_filters (GIMP_DRAWABLE (temp));
|
||||
|
||||
|
|
@ -878,8 +882,8 @@ get_buffer_with_filters (GimpLayer *layer)
|
|||
|
||||
gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE, dst_buffer, NULL);
|
||||
|
||||
gimp_image_remove_layer (image, temp);
|
||||
g_object_unref (src_buffer);
|
||||
gimp_image_delete (tmp_image);
|
||||
|
||||
return dst_buffer;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue