[gegl] edge-sobel.c: Coding style



commit aaf40be2ca222c1a253ec8e98e9d714ef5603275
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Tue May 7 07:43:15 2013 -0700

    edge-sobel.c: Coding style

 operations/common/edge-sobel.c |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/operations/common/edge-sobel.c b/operations/common/edge-sobel.c
index 33ec85b..e978138 100644
--- a/operations/common/edge-sobel.c
+++ b/operations/common/edge-sobel.c
@@ -162,21 +162,20 @@ cl_edge_sobel (cl_mem              in_tex,
                gboolean            keep_signal,
                gboolean            has_alpha)
 {
-  if (!cl_data)
-    {
-      const char *kernel_name[] = {"kernel_edgesobel", NULL};
-      cl_data = gegl_cl_compile_and_build(kernel_source, kernel_name);
-    }
-  if (!cl_data)  return 0;
-
-  {
-  const size_t gbl_size[2] = {roi->width,roi->height};
+  const size_t gbl_size[2] = {roi->width, roi->height};
   cl_int n_horizontal  = horizontal;
   cl_int n_vertical    = vertical;
   cl_int n_keep_signal = keep_signal;
   cl_int n_has_alpha   = has_alpha;
   cl_int cl_err = 0;
 
+  if (!cl_data)
+    {
+      const char *kernel_name[] = {"kernel_edgesobel", NULL};
+      cl_data = gegl_cl_compile_and_build (kernel_source, kernel_name);
+    }
+  if (!cl_data) return 0;
+
   cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 0, sizeof(cl_mem), (void*)&in_tex);
   cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 1, sizeof(cl_mem), (void*)&out_tex);
   cl_err |= gegl_clSetKernelArg(cl_data->kernel[0], 2, sizeof(cl_int), (void*)&n_horizontal);
@@ -190,20 +189,19 @@ cl_edge_sobel (cl_mem              in_tex,
                                        NULL, gbl_size, NULL,
                                        0, NULL, NULL);
   if (cl_err != CL_SUCCESS) return cl_err;
-  }
 
   return CL_SUCCESS;
 }
 
 static gboolean
 cl_process (GeglOperation       *operation,
-      GeglBuffer          *input,
-      GeglBuffer          *output,
-      const GeglRectangle *result)
+            GeglBuffer          *input,
+            GeglBuffer          *output,
+            const GeglRectangle *result,
+            gboolean             has_alpha)
 {
   const Babl *in_format  = babl_format ("RGBA float");
   const Babl *out_format = babl_format ("RGBA float");
-  gboolean    has_alpha  = babl_format_has_alpha (gegl_operation_get_format (operation, "output"));
   gint err;
   gint j;
   cl_int cl_err;
@@ -240,15 +238,15 @@ process (GeglOperation       *operation,
   GeglRectangle compute;
   gboolean has_alpha;
 
-  compute = gegl_operation_get_required_for_output (operation, "input",result);
-  has_alpha  = babl_format_has_alpha (gegl_operation_get_format (operation, "output"));
+  compute = gegl_operation_get_required_for_output (operation, "input", result);
+  has_alpha = babl_format_has_alpha (gegl_operation_get_format (operation, "output"));
 
   if (gegl_cl_is_accelerated ())
-    if(cl_process(operation, input, output, result))
+    if (cl_process (operation, input, output, result, has_alpha))
       return TRUE;
 
   edge_sobel (input, &compute, output, result, o->horizontal, o->vertical, o->keep_signal, has_alpha);
-  return  TRUE;
+  return TRUE;
 }
 
 inline static gfloat


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