app: in gimp:offset, fix OFFSET_TRANSPARENT fast-path for chunked input

This commit is contained in:
Ell
2019-06-07 03:45:17 -04:00
parent 0461022198
commit 533091055e

View File

@ -301,22 +301,31 @@ gimp_operation_offset_parent_process (GeglOperation *operation,
if (input) if (input)
{ {
const GeglRectangle *extent; GeglRectangle bounds;
GeglRectangle extent;
extent = gegl_buffer_get_extent (GEGL_BUFFER (input)); bounds = gegl_operation_get_bounding_box (GEGL_OPERATION (offset));
output = g_object_new (GEGL_TYPE_BUFFER, extent = *gegl_buffer_get_extent (GEGL_BUFFER (input));
"source", input,
"x", extent->x,
"y", extent->y,
"width", extent->width,
"height", extent->height,
"shift-x", -x,
"shift-y", -y,
NULL);
if (gegl_object_get_has_forked (input)) extent.x += x;
gegl_object_set_has_forked (output); extent.y += y;
if (gegl_rectangle_intersect (&extent, &extent, &bounds))
{
output = g_object_new (GEGL_TYPE_BUFFER,
"source", input,
"x", extent.x,
"y", extent.y,
"width", extent.width,
"height", extent.height,
"shift-x", -x,
"shift-y", -y,
NULL);
if (gegl_object_get_has_forked (input))
gegl_object_set_has_forked (output);
}
} }
gegl_operation_context_take_object (context, "output", output); gegl_operation_context_take_object (context, "output", output);