Commit 378cd512 authored by Ell's avatar Ell

matting-{global,levin}: use input bounding box as output bounding box

In gegl:matting-{global,levin}, use the input bounding box as the
output bounding box, instead of letting GeglOperationComposer use
the union of the input and aux bounding boxes.  This fixes a
segfault when the two bounding boxes are different.

See issue gimp#4174.
parent 7f851dc7
Pipeline #148870 passed with stages
in 7 minutes and 53 seconds
......@@ -81,21 +81,40 @@ matting_prepare (GeglOperation *operation)
gegl_operation_set_format (operation, "output", out_format);
}
static GeglRectangle
matting_get_bounding_box (GeglOperation *operation)
{
GeglRectangle result = {};
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation,
"input");
if (in_rect)
result = *in_rect;
return result;
}
static GeglRectangle
matting_get_invalidated_by_change (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
return matting_get_bounding_box (operation);
}
static GeglRectangle
matting_get_required_for_output (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
GeglRectangle result = *gegl_operation_source_get_bounding_box (operation,
"input");
return result;
return matting_get_bounding_box (operation);
}
static GeglRectangle
matting_get_cached_region (GeglOperation * operation,
const GeglRectangle * roi)
{
return *gegl_operation_source_get_bounding_box (operation, "input");
return matting_get_bounding_box (operation);
}
typedef struct {
......@@ -567,11 +586,13 @@ gegl_op_class_init (GeglOpClass *klass)
composer_class = GEGL_OPERATION_COMPOSER_CLASS (klass);
operation_class = GEGL_OPERATION_CLASS (klass);
composer_class->process = matting_process;
operation_class->prepare = matting_prepare;
operation_class->get_required_for_output = matting_get_required_for_output;
operation_class->get_cached_region = matting_get_cached_region;
operation_class->threaded = FALSE;
composer_class->process = matting_process;
operation_class->prepare = matting_prepare;
operation_class->get_bounding_box = matting_get_bounding_box;
operation_class->get_invalidated_by_change = matting_get_invalidated_by_change;
operation_class->get_required_for_output = matting_get_required_for_output;
operation_class->get_cached_region = matting_get_cached_region;
operation_class->threaded = FALSE;
gegl_operation_class_set_keys (operation_class,
"name" , "gegl:matting-global",
......
......@@ -235,14 +235,35 @@ matting_prepare (GeglOperation *operation)
}
static GeglRectangle
matting_get_bounding_box (GeglOperation *operation)
{
GeglRectangle result = {};
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation,
"input");
if (in_rect)
result = *in_rect;
return result;
}
static GeglRectangle
matting_get_invalidated_by_change (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
return matting_get_bounding_box (operation);
}
static GeglRectangle
matting_get_required_for_output (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
GeglRectangle result = *gegl_operation_source_get_bounding_box (operation,
"input");
return result;
return matting_get_bounding_box (operation);
}
......@@ -250,7 +271,7 @@ static GeglRectangle
matting_get_cached_region (GeglOperation * operation,
const GeglRectangle * roi)
{
return *gegl_operation_source_get_bounding_box (operation, "input");
return matting_get_bounding_box (operation);
}
......@@ -1445,10 +1466,12 @@ gegl_op_class_init (GeglOpClass *klass)
composer_class->process = matting_process;
operation_class->prepare = matting_prepare;
operation_class->get_required_for_output = matting_get_required_for_output;
operation_class->get_cached_region = matting_get_cached_region;
operation_class->threaded = FALSE;
operation_class->prepare = matting_prepare;
operation_class->get_bounding_box = matting_get_bounding_box;
operation_class->get_invalidated_by_change = matting_get_invalidated_by_change;
operation_class->get_required_for_output = matting_get_required_for_output;
operation_class->get_cached_region = matting_get_cached_region;
operation_class->threaded = FALSE;
gegl_operation_class_set_keys (operation_class,
"name", "gegl:matting-levin",
......
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