[gegl] operation-point-*: replace explicit in-place output checks with a call to ...



commit 134150914140043d2f945cd830dc288c66062bdc
Author: Ell <ell_se yahoo com>
Date:   Sat Dec 3 12:30:24 2016 -0500

    operation-point-*: replace explicit in-place output checks with a call to ...
    
    ... `gegl_operation_context_get_output_maybe_in_place()`, which does the
    same thing.
    
    Also, a small newline fix.

 gegl/operation/gegl-operation-point-composer.c  |   20 ++++++--------------
 gegl/operation/gegl-operation-point-composer3.c |   20 ++++++--------------
 gegl/operation/gegl-operation-point-filter.c    |   18 +++++-------------
 gegl/operation/gegl-operations.c                |    7 ++++---
 4 files changed, 21 insertions(+), 44 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index 643f34a..5cca499 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -102,8 +102,7 @@ gegl_operation_composer_process (GeglOperation        *operation,
                                  const GeglRectangle  *result,
                                  gint                  level)
 {
-  GeglOperationComposerClass *klass    = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
-  GeglOperationClass         *op_class = GEGL_OPERATION_CLASS (klass);
+  GeglOperationComposerClass *klass   = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
   GeglBuffer                 *input;
   GeglBuffer                 *aux;
   GeglBuffer                 *output;
@@ -121,18 +120,11 @@ gegl_operation_composer_process (GeglOperation        *operation,
     return TRUE;
   }
 
-  input = gegl_operation_context_get_source (context, "input");
-
-  if (op_class->want_in_place && 
-      gegl_can_do_inplace_processing (operation, input, result))
-    {
-      output = g_object_ref (input);
-      gegl_operation_context_take_object (context, "output", G_OBJECT (output));
-    }
-  else
-    {
-      output = gegl_operation_context_get_target (context, "output");
-    }
+  input  = gegl_operation_context_get_source (context, "input");
+  output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                             context,
+                                                             input,
+                                                             result);
 
   aux   = gegl_operation_context_get_source (context, "aux");
 
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index 450a888..c7f95ed 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -111,8 +111,7 @@ gegl_operation_composer3_process (GeglOperation        *operation,
                                   const GeglRectangle  *result,
                                   gint                  level)
 {
-  GeglOperationComposer3Class *klass    = GEGL_OPERATION_COMPOSER3_GET_CLASS (operation);
-  GeglOperationClass          *op_class = GEGL_OPERATION_CLASS (klass);
+  GeglOperationComposer3Class *klass   = GEGL_OPERATION_COMPOSER3_GET_CLASS (operation);
   GeglBuffer                  *input;
   GeglBuffer                  *aux;
   GeglBuffer                  *aux2;
@@ -131,18 +130,11 @@ gegl_operation_composer3_process (GeglOperation        *operation,
     return TRUE;
   }
 
-  input = gegl_operation_context_get_source (context, "input");
-
-  if (op_class->want_in_place && 
-      gegl_can_do_inplace_processing (operation, input, result))
-    {
-      output = g_object_ref (input);
-      gegl_operation_context_take_object (context, "output", G_OBJECT (output));
-    }
-  else
-    {
-      output = gegl_operation_context_get_target (context, "output");
-    }
+  input  = gegl_operation_context_get_source (context, "input");
+  output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                             context,
+                                                             input,
+                                                             result);
 
   aux   = gegl_operation_context_get_source (context, "aux");
   aux2  = gegl_operation_context_get_source (context, "aux2");
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index 7dd73ca..d3b8241 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -98,7 +98,6 @@ gegl_operation_filter_process (GeglOperation        *operation,
                                  gint                  level)
 {
   GeglOperationFilterClass *klass    = GEGL_OPERATION_FILTER_GET_CLASS (operation);
-  GeglOperationClass         *op_class = GEGL_OPERATION_CLASS (klass);
   GeglBuffer                 *input;
   GeglBuffer                 *output;
   gboolean                    success = FALSE;
@@ -115,18 +114,11 @@ gegl_operation_filter_process (GeglOperation        *operation,
     return TRUE;
   }
 
-  input = gegl_operation_context_get_source (context, "input");
-
-  if (op_class->want_in_place && 
-      gegl_can_do_inplace_processing (operation, input, result))
-    {
-      output = g_object_ref (input);
-      gegl_operation_context_take_object (context, "output", G_OBJECT (output));
-    }
-  else
-    {
-      output = gegl_operation_context_get_target (context, "output");
-    }
+  input  = gegl_operation_context_get_source (context, "input");
+  output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                             context,
+                                                             input,
+                                                             result);
 
   if (input != NULL)
     {
diff --git a/gegl/operation/gegl-operations.c b/gegl/operation/gegl-operations.c
index 3bec134..651dd3b 100644
--- a/gegl/operation/gegl-operations.c
+++ b/gegl/operation/gegl-operations.c
@@ -312,9 +312,10 @@ gegl_operation_gtype_cleanup (void)
   g_mutex_unlock (&operations_cache_mutex);
 }
 
-gboolean gegl_can_do_inplace_processing (GeglOperation       *operation,
-                                         GeglBuffer          *input,
-                                         const GeglRectangle *result)
+gboolean
+gegl_can_do_inplace_processing (GeglOperation       *operation,
+                                GeglBuffer          *input,
+                                const GeglRectangle *result)
 {
   if (!input)
     return FALSE;


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