[gegl] operations: image-compare never set the output black



commit 01844d44e4cf290d9980d6a3cf2b3b64eb371541
Author: Téo Mazars <teo mazars ensimag fr>
Date:   Thu Oct 17 12:18:25 2013 +0200

    operations: image-compare never set the output black

 operations/common/image-compare.c |   61 ++++++++++++++++---------------------
 1 files changed, 26 insertions(+), 35 deletions(-)
---
diff --git a/operations/common/image-compare.c b/operations/common/image-compare.c
index eb41297..4367d2b 100644
--- a/operations/common/image-compare.c
+++ b/operations/common/image-compare.c
@@ -143,49 +143,40 @@ process (GeglOperation       *operation,
         }
     }
 
-  if (wrong_pixels)
-    {
-      iter  = gegl_buffer_iterator_new (output, result, 0, srgb,
-                                        GEGL_BUFFER_WRITE, GEGL_ABYSS_NONE);
+  iter  = gegl_buffer_iterator_new (output, result, 0, srgb,
+                                    GEGL_BUFFER_WRITE, GEGL_ABYSS_NONE);
+
+  gegl_buffer_iterator_add (iter, diff_buffer, result, 0, yadbl,
+                            GEGL_BUFFER_READ, GEGL_ABYSS_NONE);
 
-      gegl_buffer_iterator_add (iter, diff_buffer, result, 0, yadbl,
-                                GEGL_BUFFER_READ, GEGL_ABYSS_NONE);
+  while (gegl_buffer_iterator_next (iter))
+    {
+      gint     i;
+      guchar  *out  = iter->data[0];
+      gdouble *data = iter->data[1];
 
-      while (gegl_buffer_iterator_next (iter))
+      for (i = 0; i < iter->length; i++)
         {
-          gint     i;
-          guchar  *out  = iter->data[0];
-          gdouble *data = iter->data[1];
+          gdouble diff = data[0];
+          gdouble a = data[1];
 
-          for (i = 0; i < iter->length; i++)
+          if (diff >= 0.01)
             {
-              gdouble diff = data[0];
-              gdouble a = data[1];
-
-              if (diff >= 0.01)
-                {
-                  out[0] = CLAMP ((100 - a) / 100.0 * 64 + 32, 0, 255);
-                  out[1] = CLAMP (diff / max_diff * 255, 0, 255);
-                  out[2] = 0;
-                }
-              else
-                {
-                  out[0] = CLAMP (a / 100.0 * 255, 0, 255);
-                  out[1] = CLAMP (a / 100.0 * 255, 0, 255);
-                  out[2] = CLAMP (a / 100.0 * 255, 0, 255);
-                }
-
-              out  += 3;
-              data += 2;
+              out[0] = CLAMP ((100 - a) / 100.0 * 64 + 32, 0, 255);
+              out[1] = CLAMP (diff / max_diff * 255, 0, 255);
+              out[2] = 0;
             }
+          else
+            {
+              out[0] = CLAMP (a / 100.0 * 255, 0, 255);
+              out[1] = CLAMP (a / 100.0 * 255, 0, 255);
+              out[2] = CLAMP (a / 100.0 * 255, 0, 255);
+            }
+
+          out  += 3;
+          data += 2;
         }
     }
-  else
-    {
-      GeglColor *black = gegl_color_new ("black");
-      gegl_buffer_set_color (output, NULL, black);
-      g_object_unref (black);
-    }
 
   g_object_unref (diff_buffer);
 


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