app: use underlying operation in gimp_gegl_apply_cached_operation()

In gimp_gegl_apply_cached_operation(), use the underlying
operation, as returned from
gimp_gegl_node_get_underlying_operation(), for testing whether the
operation is a point operation, for the purpose of avoiding
duplicating the input buffer.  Likewise, avoid duplicating the
buffer when the underlying operation is a source operation.

(cherry picked from commit 213b126c6e)
This commit is contained in:
Ell
2019-03-27 15:04:27 -04:00
parent 5e212fe0dd
commit b5b5d71708

View File

@ -118,13 +118,18 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
if (src_buffer) if (src_buffer)
{ {
GeglNode *src_node; GeglNode *src_node;
GeglNode *underlying_operation;
underlying_operation =
gimp_gegl_node_get_underlying_operation (operation);
/* dup() because reading and writing the same buffer doesn't /* dup() because reading and writing the same buffer doesn't
* generally work with non-point ops when working in chunks. * generally work with non-point ops when working in chunks.
* See bug #701875. * See bug #701875.
*/ */
if (src_buffer == dest_buffer && if (src_buffer == dest_buffer &&
! gimp_gegl_node_is_point_operation (operation)) ! (gimp_gegl_node_is_point_operation (underlying_operation) ||
gimp_gegl_node_is_source_operation (underlying_operation)))
{ {
src_buffer = gegl_buffer_dup (src_buffer); src_buffer = gegl_buffer_dup (src_buffer);
} }