[gegl] fractal-trace: pass-through on infinite planes (issue #179)



commit 03aec5c008a81df01dd72fec5d307e21fba6580e
Author: Thomas Manni <thomas manni free fr>
Date:   Wed Jul 31 20:57:51 2019 +0200

    fractal-trace: pass-through on infinite planes (issue #179)

 operations/common-gpl3+/fractal-trace.c | 35 ++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
---
diff --git a/operations/common-gpl3+/fractal-trace.c b/operations/common-gpl3+/fractal-trace.c
index a41936251..2cef5508a 100644
--- a/operations/common-gpl3+/fractal-trace.c
+++ b/operations/common-gpl3+/fractal-trace.c
@@ -219,7 +219,39 @@ get_required_for_output (GeglOperation       *operation,
                          const gchar         *input_pad,
                          const GeglRectangle *roi)
 {
-  return gegl_operation_get_bounding_box (operation);
+  const GeglRectangle *in_rect =
+      gegl_operation_source_get_bounding_box (operation, "input");
+
+  if (in_rect && ! gegl_rectangle_is_infinite_plane (in_rect))
+    return *in_rect;
+
+  return *roi;
+}
+
+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
@@ -232,6 +264,7 @@ gegl_op_class_init (GeglOpClass *klass)
   filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
 
   operation_class->get_required_for_output = get_required_for_output;
+  operation_class->process                 = operation_process;
 
   filter_class->process                    = process;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]