[gegl] motion-blur-circular: pass-through on infinite planes (issue #179)



commit d852b3e8b145c4c7eac03519b98757f951d1ae4c
Author: Thomas Manni <thomas manni free fr>
Date:   Sun Aug 4 09:47:22 2019 +0200

    motion-blur-circular: pass-through on infinite planes (issue #179)

 operations/common-gpl3+/motion-blur-circular.c | 29 +++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/operations/common-gpl3+/motion-blur-circular.c b/operations/common-gpl3+/motion-blur-circular.c
index ce2505e2f..488cd48c3 100644
--- a/operations/common-gpl3+/motion-blur-circular.c
+++ b/operations/common-gpl3+/motion-blur-circular.c
@@ -78,7 +78,7 @@ prepare (GeglOperation *operation)
 
   whole_region = gegl_operation_source_get_bounding_box (operation, "input");
 
-  if (whole_region != NULL)
+  if (whole_region && ! gegl_rectangle_is_infinite_plane (whole_region))
     {
       gdouble center_x = gegl_coordinate_relative_to_pixel (o->center_x,
                                                             whole_region->width);
@@ -403,6 +403,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)
 {
@@ -413,6 +439,7 @@ gegl_op_class_init (GeglOpClass *klass)
   filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
 
   operation_class->prepare = prepare;
+  operation_class->process = operation_process;
   operation_class->opencl_support = TRUE;
 
   filter_class->process    = process;


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