[gegl] fractal-trace: Fix coding style, remove trailing spaces



commit 3736528e9187503cb4779a89c24c8966023b2ae0
Author: Mukund Sivaraman <muks banu com>
Date:   Thu Jun 30 21:10:18 2011 +0530

    fractal-trace: Fix coding style, remove trailing spaces

 operations/workshop/fractal-trace.c |  189 +++++++++++++++++------------------
 1 files changed, 93 insertions(+), 96 deletions(-)
---
diff --git a/operations/workshop/fractal-trace.c b/operations/workshop/fractal-trace.c
index 6fb41b4..b3f76a1 100644
--- a/operations/workshop/fractal-trace.c
+++ b/operations/workshop/fractal-trace.c
@@ -26,27 +26,26 @@ gegl_chant_string (fractal, _("Fractal"), "fractal",
                    _("Type of fractal to use. "
                      "Choices are julia, mandelbrot. Default is mandelbrot."))
 gegl_chant_double (X1, _("X1"), -50.0, 50.0, -1.00,
-                  _("X1 value, position"))
+                   _("X1 value, position"))
 gegl_chant_double (X2, _("X2"), -50.0, 50.0, 0.50,
-                  _("X2 value, position"))
+                   _("X2 value, position"))
 gegl_chant_double (Y1, _("Y1"), -50.0, 50.0, -1.00,
-                  _("X2 value, position"))
+                   _("X2 value, position"))
 gegl_chant_double (Y2, _("Y2"), -50.0, 50.0, 1.00,
-                  _("Y2 value, position"))
+                   _("Y2 value, position"))
 gegl_chant_double (JX, _("JX"), -50.0, 50.0, 0.5,
                    _("Julia seed X value, position"))
 gegl_chant_double (JY, _("JY"), -50.0, 50.0, 0.5,
                    _("Julia seed Y value, position"))
 gegl_chant_int    (depth, _("Depth"), 1, 50, 3,
-                  _("Depth value"))
+                   _("Depth value"))
 gegl_chant_string (background, _("Background"), "wrap",
-                  _("Optional parameter to override automatic selection of wrap background. "
-                    "Choices are wrap, black, white and transparent"))
+                   _("Optional parameter to override automatic selection of wrap background. "
+                     "Choices are wrap, black, white and transparent."))
 
-# else
+#else
 
 #define GEGL_CHANT_TYPE_FILTER
-
 #define GEGL_CHANT_C_FILE       "fractal-trace.c"
 
 #include "gegl-chant.h"
@@ -58,7 +57,7 @@ typedef enum
   OUTSIDE_TYPE_WRAP,
   OUTSIDE_TYPE_TRANSPARENT,
   OUTSIDE_TYPE_BLACK,
-  OUTSIDE_TYPE_WHITE 
+  OUTSIDE_TYPE_WHITE
 } OutsideType;
 
 typedef enum
@@ -67,12 +66,11 @@ typedef enum
   FRACTAL_TYPE_JULIA
 } FractalType;
 
-
 static void prepare (GeglOperation *operation)
 {
   gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
   gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}   
+}
 
 static void
 julia (gdouble  x,
@@ -105,7 +103,6 @@ julia (gdouble  x,
   *v = yy;
 }
 
-
 static void
 fractaltrace (GeglBuffer          *input,
               const GeglRectangle *picture,
@@ -133,11 +130,11 @@ fractaltrace (GeglBuffer          *input,
 
   for (x = roi->x; x < roi->x + roi->width; x++)
     {
-       dest[1] = dest[2] = dest[3] = dest[0] = 0.0;
-       cx = o->X1 + (x - picture->x) * scale_x;
+      dest[1] = dest[2] = dest[3] = dest[0] = 0.0;
+      cx = o->X1 + (x - picture->x) * scale_x;
 
-       switch (fractal)
-	{
+      switch (fractal)
+        {
         case FRACTAL_TYPE_JULIA:
           julia (cx, cy, o->JX, o->JY, &px, &py, o->depth, escape_radius);
           break;
@@ -148,79 +145,80 @@ fractaltrace (GeglBuffer          *input,
           g_error (_("Unsupported fractal type"));
         }
 
-       px = (px - o->X1) / scale_x + picture->x;
-       py = (py - o->Y1) / scale_y + picture->y;
+      px = (px - o->X1) / scale_x + picture->x;
+      py = (py - o->Y1) / scale_y + picture->y;
 
-       if (0 <= px && px < picture->width && 0 <= py && py < picture->height)
-          {
+      if (0 <= px && px < picture->width && 0 <= py && py < picture->height)
+        {
           gegl_buffer_sample (input, px, py, 1.0, dest, format,
-                             GEGL_INTERPOLATION_LINEAR);
-          }
-       else
-         {
-           switch (id)
-             {
-             case OUTSIDE_TYPE_WRAP:
-               px = fmod (px, picture->width);
-               py = fmod (py, picture->height);
-               if (px < 0.0) px += picture->width;
-               if (py < 0.0) py += picture->height;
-               /*associating to NaN and -NaN values, if there is the case*/
-
-               if (isnan(px))
-                  {
-                  if (signbit(px)) 
-                      {
+                              GEGL_INTERPOLATION_LINEAR);
+        }
+      else
+        {
+          switch (id)
+            {
+            case OUTSIDE_TYPE_WRAP:
+              px = fmod (px, picture->width);
+              py = fmod (py, picture->height);
+              if (px < 0.0) px += picture->width;
+              if (py < 0.0) py += picture->height;
+              /*associating to NaN and -NaN values, if there is the case*/
+
+              if (isnan(px))
+                {
+                  if (signbit(px))
+                    {
                       px = 0.0;
-                      }
-                  else 
-                      {
+                    }
+                  else
+                    {
                       px = (gdouble) picture->width - 1.0;
-                      }
-                  }
-
-               if (isnan(py))
-                  {
-                  if (signbit(py)) 
-                       {
-                       py = 0.0;
-                       }
-                  else  
-                       {
-                       py = (gdouble) picture->height -1.0;
-                       }
-                  }
-
-               gegl_buffer_sample (input, px, py, 1.0, dest, format, 
+                    }
+                }
+
+              if (isnan(py))
+                {
+                  if (signbit(py))
+                    {
+                      py = 0.0;
+                    }
+                  else
+                    {
+                      py = (gdouble) picture->height -1.0;
+                    }
+                }
+
+              gegl_buffer_sample (input, px, py, 1.0, dest, format,
                                   GEGL_INTERPOLATION_LINEAR);
-               break;
-             case OUTSIDE_TYPE_TRANSPARENT:
-               dest[0] = dest[1] = dest[2] = dest[3] = 0.0;
-               break;
-             case OUTSIDE_TYPE_BLACK:
-               dest[0] = dest[1] = dest[2] = 0.0;
-               dest[3] = 1.0;
-               break;
-             case OUTSIDE_TYPE_WHITE:
-               dest[0] = dest[1] = dest[2] = dest[3] = 1.0;
-               break;
-             }
-         }
+              break;
+            case OUTSIDE_TYPE_TRANSPARENT:
+              dest[0] = dest[1] = dest[2] = dest[3] = 0.0;
+              break;
+            case OUTSIDE_TYPE_BLACK:
+              dest[0] = dest[1] = dest[2] = 0.0;
+              dest[3] = 1.0;
+              break;
+            case OUTSIDE_TYPE_WHITE:
+              dest[0] = dest[1] = dest[2] = dest[3] = 1.0;
+              break;
+            }
+        }
+
       /*upload pixel value is destination buffer*/
-        for(i = 0;i < 4; i++)
-	  dst_buf[offset++] = dest[i];
+      for (i = 0; i < 4; i++)
+        dst_buf[offset++] = dest[i];
     }
 }
 
 
-static gboolean 
+static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
   GeglChantO    *o            = GEGL_CHANT_PROPERTIES (operation);
-  GeglRectangle  boundary     = gegl_operation_get_bounding_box (operation); 
+  GeglRectangle  boundary     = gegl_operation_get_bounding_box (operation);
   Babl          *format       = babl_format ("RGBA float");
 
   FractalType       frT;
@@ -236,18 +234,18 @@ process (GeglOperation       *operation,
 
   id = OUTSIDE_TYPE_WRAP; /*wrap is default*/
   if (!strcmp(o->background,"wrap"))
-      id = OUTSIDE_TYPE_WRAP;
-  else if (!strcmp(o->background,"transparent")) 
-      id = OUTSIDE_TYPE_TRANSPARENT;
-  else if (!strcmp(o->background,"black"))       
-      id = OUTSIDE_TYPE_BLACK;
+    id = OUTSIDE_TYPE_WRAP;
+  else if (!strcmp(o->background,"transparent"))
+    id = OUTSIDE_TYPE_TRANSPARENT;
+  else if (!strcmp(o->background,"black"))
+    id = OUTSIDE_TYPE_BLACK;
   else if (!strcmp(o->background,"white"))
-      id = OUTSIDE_TYPE_WHITE;
+    id = OUTSIDE_TYPE_WHITE;
 
   dst_buf = g_new0 (gfloat, result->width * result->height * 4);
 
   for (y = result->y; y < result->y + result->height; y++)
-	fractaltrace(input, &boundary, dst_buf, result, o, y, frT, id, format);
+    fractaltrace (input, &boundary, dst_buf, result, o, y, frT, id, format);
 
   gegl_buffer_set (output, result, format, dst_buf, GEGL_AUTO_ROWSTRIDE);
 
@@ -275,14 +273,14 @@ get_bounding_box (GeglOperation *operation)
   GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
 
   if (!in_rect){
-        return result;
+    return result;
   }
 
   gegl_rectangle_copy(&result, in_rect);
 
-  #ifdef TRACE
-    g_warning ("< get_bounding_box result = %dx%d+%d+%d", result.width, result.height, result.x, result.y);
-  #endif
+#ifdef TRACE
+  g_warning ("< get_bounding_box result = %dx%d+%d+%d", result.width, result.height, result.x, result.y);
+#endif
   return result;
 }
 
@@ -296,17 +294,17 @@ get_required_for_output (GeglOperation       *operation,
 {
   GeglRectangle  result = get_effective_area (operation);
 
-  #ifdef TRACE
-    g_warning ("> get_required_for_output src=%dx%d+%d+%d", result.width, result.height, result.x, result.y);
-    if (roi)
-      g_warning ("  ROI == %dx%d+%d+%d", roi->width, roi->height, roi->x, roi->y);
-  #endif
+#ifdef TRACE
+  g_warning ("> get_required_for_output src=%dx%d+%d+%d", result.width, result.height, result.x, result.y);
+  if (roi)
+    g_warning ("  ROI == %dx%d+%d+%d", roi->width, roi->height, roi->x, roi->y);
+#endif
 
   return result;
 }
 
 
-static void 
+static void
 gegl_chant_class_init (GeglChantClass *klass)
 {
   GeglOperationClass       *operation_class;
@@ -317,13 +315,12 @@ gegl_chant_class_init (GeglChantClass *klass)
 
   filter_class->process                    = process;
   operation_class->prepare                 = prepare;
-  operation_class->get_bounding_box = get_bounding_box;
+  operation_class->get_bounding_box        = get_bounding_box;
   operation_class->get_required_for_output = get_required_for_output;
 
-  operation_class->categories = "map";
-  operation_class->name       = "gegl:fractal-trace";
-  operation_class->description =
-          _("Performs fractal trace on the image");
+  operation_class->categories  = "map";
+  operation_class->name        = "gegl:fractal-trace";
+  operation_class->description = _("Performs fractal trace on the image");
 }
 
 #endif



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