[gegl] waterpixels: pass-through on infinite planes (issue #179)
- From: Thomas Manni <tmanni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] waterpixels: pass-through on infinite planes (issue #179)
- Date: Tue, 30 Jul 2019 22:19:39 +0000 (UTC)
commit b9b9a626047c36a9c2794df37575bbf9146c5ce9
Author: Thomas Manni <thomas manni free fr>
Date: Wed Jul 31 00:13:00 2019 +0200
waterpixels: pass-through on infinite planes (issue #179)
operations/common/waterpixels.c | 46 +++++++++++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 9 deletions(-)
---
diff --git a/operations/common/waterpixels.c b/operations/common/waterpixels.c
index 0d5a6d881..c45cfeb8f 100644
--- a/operations/common/waterpixels.c
+++ b/operations/common/waterpixels.c
@@ -434,25 +434,26 @@ get_required_for_output (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
- GeglRectangle result = *gegl_operation_source_get_bounding_box (operation, "input");
+ const GeglRectangle *in_rect =
+ gegl_operation_source_get_bounding_box (operation, "input");
- /* Don't request an infinite plane */
- if (gegl_rectangle_is_infinite_plane (&result))
- return *roi;
+ if (in_rect && ! gegl_rectangle_is_infinite_plane (in_rect))
+ return *in_rect;
- return result;
+ return *roi;
}
static GeglRectangle
get_cached_region (GeglOperation *operation,
const GeglRectangle *roi)
{
- GeglRectangle result = *gegl_operation_source_get_bounding_box (operation, "input");
+ const GeglRectangle *in_rect =
+ gegl_operation_source_get_bounding_box (operation, "input");
- if (gegl_rectangle_is_infinite_plane (&result))
- return *roi;
+ if (in_rect && ! gegl_rectangle_is_infinite_plane (in_rect))
+ return *in_rect;
- return result;
+ return *roi;
}
static gboolean
@@ -494,6 +495,32 @@ process (GeglOperation *operation,
return TRUE;
}
+static gboolean
+operation_process (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result,
+ gint level)
+{
+ GeglOperationClass *operation_class;
+
+ const GeglRectangle *in_rect =
+ gegl_operation_source_get_bounding_box (operation, "input");
+
+ if (in_rect && gegl_rectangle_is_infinite_plane (in_rect))
+ {
+ gpointer in = gegl_operation_context_get_object (context, "input");
+ gegl_operation_context_take_object (context, "output",
+ g_object_ref (G_OBJECT (in)));
+ return TRUE;
+ }
+
+ operation_class = GEGL_OPERATION_CLASS (gegl_op_parent_class);
+
+ return operation_class->process (operation, context, output_prop, result,
+ gegl_operation_context_get_level (context));
+}
+
static void
gegl_op_class_init (GeglOpClass *klass)
{
@@ -505,6 +532,7 @@ gegl_op_class_init (GeglOpClass *klass)
filter_class->process = process;
operation_class->prepare = prepare;
+ operation_class->process = operation_process;
operation_class->get_required_for_output = get_required_for_output;
operation_class->get_cached_region = get_cached_region;
operation_class->opencl_support = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]