[gegl/soc-2012-editor] invert: rewrite without too much loop and variables



commit 56881c2b946b8a8a3274e5100b0b6d22f33334d8
Author: Michael Murà <mure michael gmail com>
Date:   Sun Apr 29 00:23:43 2012 +0900

    invert: rewrite without too much loop and variables

 operations/common/invert.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/operations/common/invert.c b/operations/common/invert.c
index f5e0afa..cd49db4 100644
--- a/operations/common/invert.c
+++ b/operations/common/invert.c
@@ -40,21 +40,16 @@ process (GeglOperation       *op,
          const GeglRectangle *roi,
          gint                 level)
 {
-  glong   i;
   gfloat *in  = in_buf;
   gfloat *out = out_buf;
 
-  for (i=0; i<samples; i++)
+  while (samples--)
     {
-      int  j;
-      for (j=0; j<3; j++)
-        {
-          gfloat c;
-          c = in[j];
-          c = 1.0 - c;
-          out[j] = c;
-        }
-      out[3]=in[3];
+      out[0] = 1.0 - in[0];
+      out[1] = 1.0 - in[1];
+      out[2] = 1.0 - in[2];
+      out[3] = in[3];
+
       in += 4;
       out+= 4;
     }



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