[gegl] domain-transform: pass-through when edge preservation is 1.0 ...



commit 50f304eb2d143948abe7e3072b35bb598300887b
Author: Thomas Manni <thomas manni free fr>
Date:   Thu Jul 18 18:38:00 2019 +0200

    domain-transform: pass-through when edge preservation is 1.0 ...
    
    ... instead of using gegl_buffer_copy.

 operations/workshop/domain-transform.c | 40 +++++++++++++++-------------------
 1 file changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/operations/workshop/domain-transform.c b/operations/workshop/domain-transform.c
index ee1a6cf1a..e92d86f9e 100644
--- a/operations/workshop/domain-transform.c
+++ b/operations/workshop/domain-transform.c
@@ -443,33 +443,27 @@ process (GeglOperation       *operation,
   GeglProperties  *o = GEGL_PROPERTIES (operation);
   gfloat range_factor;
 
-  if (o->edge_preservation != 1.0f)
-    {
-      if (o->edge_preservation != 0.0)
-        range_factor = (1.0 / o->edge_preservation) - 1.0f;
-      else
-        range_factor = G_MAXFLOAT;
-  
-      /* Buffer is ready for domain transform */
-      domain_transform (operation,
-                        result->width,
-                        result->height,
-                        4,
-                        o->spatial_factor,
-                        range_factor,
-                        o->n_iterations,
-                        input,
-                        output);
-    }
+  if (o->edge_preservation != 0.0)
+    range_factor = (1.0 / o->edge_preservation) - 1.0f;
   else
-    {
-      gegl_buffer_copy (input, result, GEGL_ABYSS_NONE, output, result);
-    }
+    range_factor = G_MAXFLOAT;
+
+  /* Buffer is ready for domain transform */
+  domain_transform (operation,
+                    result->width,
+                    result->height,
+                    4,
+                    o->spatial_factor,
+                    range_factor,
+                    o->n_iterations,
+                    input,
+                    output);
 
   return TRUE;
 }
 
 /* Pass-through when trying to perform a reduction on an infinite plane
+ * or when edge preservation is one.
  */
 static gboolean
 operation_process (GeglOperation        *operation,
@@ -478,6 +472,7 @@ operation_process (GeglOperation        *operation,
                    const GeglRectangle  *result,
                    gint                  level)
 {
+  GeglProperties      *o = GEGL_PROPERTIES (operation);
   GeglOperationClass  *operation_class;
 
   const GeglRectangle *in_rect =
@@ -485,7 +480,8 @@ operation_process (GeglOperation        *operation,
 
   operation_class = GEGL_OPERATION_CLASS (gegl_op_parent_class);
 
-  if (in_rect && gegl_rectangle_is_infinite_plane (in_rect))
+  if ((in_rect && gegl_rectangle_is_infinite_plane (in_rect)) ||
+       o->edge_preservation == 1.0)
     {
       gpointer in = gegl_operation_context_get_object (context, "input");
       gegl_operation_context_take_object (context, "output",


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