app: avoid unnecessarily updating drawable after merging filter

In gimp_drawable_merge_filter(), add an "update" parameter, which
specifies whether to update the affected region of the drawable
after applying the filter.  Avoid updating the drawable when
commiting a GimpDrawableFilter (and manually update the drawable if
filter application was cancelled), and when anchoring a floating
selection, since in both cases the relevant region of the drawable
has already been updated.
This commit is contained in:
Ell 2019-06-01 13:18:14 -04:00
parent 6d781ec41f
commit d928a80b7f
4 changed files with 16 additions and 7 deletions

View File

@ -109,7 +109,8 @@ gimp_drawable_merge_filter (GimpDrawable *drawable,
GimpFilter *filter,
GimpProgress *progress,
const gchar *undo_desc,
gboolean cancellable)
gboolean cancellable,
gboolean update)
{
GimpImage *image;
GimpApplicator *applicator;
@ -225,9 +226,12 @@ gimp_drawable_merge_filter (GimpDrawable *drawable,
gimp_applicator_set_output_format (applicator, applicator_output_format);
}
gimp_drawable_update (drawable,
rect.x, rect.y,
rect.width, rect.height);
if (update)
{
gimp_drawable_update (drawable,
rect.x, rect.y,
rect.width, rect.height);
}
return success;
}

View File

@ -37,7 +37,8 @@ gboolean gimp_drawable_merge_filter (GimpDrawable *drawable,
GimpFilter *filter,
GimpProgress *progress,
const gchar *undo_desc,
gboolean cancellable);
gboolean cancellable,
gboolean update);
#endif /* __GIMP_DRAWABLE_FILTERS_H__ */

View File

@ -448,10 +448,14 @@ gimp_drawable_filter_commit (GimpDrawableFilter *filter,
GIMP_FILTER (filter),
progress,
gimp_object_get_name (filter),
cancellable);
cancellable,
FALSE);
gimp_drawable_filter_remove_filter (filter);
if (! success)
gimp_drawable_filter_update_drawable (filter, NULL);
g_signal_emit (filter, drawable_filter_signals[FLUSH], 0);
}

View File

@ -135,7 +135,7 @@ floating_sel_anchor (GimpLayer *layer)
}
if (filter)
gimp_drawable_merge_filter (drawable, filter, NULL, NULL, FALSE);
gimp_drawable_merge_filter (drawable, filter, NULL, NULL, FALSE, FALSE);
gimp_image_remove_layer (image, layer, TRUE, NULL);