Commit 11629fde authored by Ell's avatar Ell

app: avoid dropping cached data when committing filters

In gimp_gegl_apply_cached_operation(), add a boolean
connect_src_buffer parameter, which determines whether to connect
the source buffer to the operation-node's input, or to use its
existing input.  In gimp_drawable_merge_filter(), pass FALSE for
connect_src_buffer, so that the existing filter-node input is used.
This produces an equivalent result, however, it avoids invalidating
the filter node, and dropping cached data as a result.  In
operations that cache larger areas than the ROI, this avoids
reprocessing already-cached data when processing the rest of the
operation.

Additionally, in gimp_gegl_apply_cached_operation(), use an empty
input for the operation if src_buffer is NULL and
connect_src_buffer is TRUE; previously, we'd use the operation-
node's existing input when src_buffer was NULL.  Furthermore, crop
the operation-node's input to the destination rect when crop_input
is TRUE, even if connect_src_buffer is FALSE.
parent 50b8adc7
Pipeline #120471 passed with stages
in 24 minutes and 52 seconds
......@@ -217,7 +217,7 @@ gimp_drawable_merge_filter (GimpDrawable *drawable,
if (gimp_gegl_apply_cached_operation (gimp_drawable_get_buffer (drawable),
progress, undo_desc,
gimp_filter_get_node (filter),
gimp_filter_get_node (filter), FALSE,
dest_buffer, &rect, FALSE,
cache, rects, n_rects,
cancellable))
......
......@@ -62,6 +62,7 @@ gimp_gegl_apply_operation (GeglBuffer *src_buffer,
gimp_gegl_apply_cached_operation (src_buffer,
progress, undo_desc,
operation,
TRUE,
dest_buffer,
dest_rect,
crop_input,
......@@ -81,6 +82,7 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
GimpProgress *progress,
const gchar *undo_desc,
GeglNode *operation,
gboolean connect_src_buffer,
GeglBuffer *dest_buffer,
const GeglRectangle *dest_rect,
gboolean crop_input,
......@@ -226,14 +228,21 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
effect = operation;
if (src_buffer)
if (connect_src_buffer || crop_input)
{
GeglNode *src_node;
operation_src_node = gegl_node_get_producer (operation, "input", NULL);
src_node = operation_src_node;
if (connect_src_buffer)
{
src_node = gegl_node_new_child (gegl,
"operation", "gegl:buffer-source",
"buffer", src_buffer,
NULL);
}
if (crop_input)
{
......@@ -253,8 +262,6 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
src_node = crop_node;
}
operation_src_node = gegl_node_get_producer (operation, "input", NULL);
if (! gegl_node_has_pad (operation, "input"))
{
effect = gegl_node_new_child (gegl,
......
......@@ -38,6 +38,7 @@ gboolean gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
GimpProgress *progress,
const gchar *undo_desc,
GeglNode *operation,
gboolean connect_src_buffer,
GeglBuffer *dest_buffer,
const GeglRectangle *dest_rect,
gboolean crop_input,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment