[gegl] snn-mean: pass-through when radius is set to 0 (issue #267)



commit a802daa925dc4a7517a0be5236fbb829cb0f5a08
Author: Thomas Manni <thomas manni free fr>
Date:   Sun Jan 31 14:21:52 2021 +0100

    snn-mean: pass-through when radius is set to 0 (issue #267)

 operations/common/snn-mean.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
---
diff --git a/operations/common/snn-mean.c b/operations/common/snn-mean.c
index 54a91070c..e034192f8 100644
--- a/operations/common/snn-mean.c
+++ b/operations/common/snn-mean.c
@@ -336,6 +336,32 @@ cl_process (GeglOperation       *operation,
   return TRUE;
 }
 
+/* Pass-through when radius parameter is set to zero */
+
+static gboolean
+operation_process (GeglOperation        *operation,
+                   GeglOperationContext *context,
+                   const gchar          *output_prop,
+                   const GeglRectangle  *result,
+                   gint                  level)
+{
+  GeglOperationClass  *operation_class;
+  GeglProperties      *o = GEGL_PROPERTIES (operation);
+
+  operation_class = GEGL_OPERATION_CLASS (gegl_op_parent_class);
+
+  if (! o->radius)
+    {
+      gpointer in = gegl_operation_context_get_object (context, "input");
+      gegl_operation_context_take_object (context, "output",
+                                          g_object_ref (G_OBJECT (in)));
+      return TRUE;
+    }
+
+  return operation_class->process (operation, context, output_prop, result,
+                                   gegl_operation_context_get_level (context));
+}
+
 static void
 gegl_op_class_init (GeglOpClass *klass)
 {
@@ -347,6 +373,7 @@ gegl_op_class_init (GeglOpClass *klass)
 
   filter_class->process    = process;
   operation_class->prepare = prepare;
+  operation_class->process = operation_process;
 
   operation_class->opencl_support = TRUE;
 


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