[gimp/soc-2011-seamless-clone2] app: histogram typos



commit 992ed0d40ea31ed7f5b69875267c185fa977d1e9
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sun Apr 21 18:32:13 2013 +0200

    app: histogram typos
    
    correctly offset the mask,
    don't crash computing the histogram of a GRAY image selection
    and don't use an integer division

 app/core/gimpdrawable-histogram.c |    2 +-
 app/core/gimphistogram.c          |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimpdrawable-histogram.c b/app/core/gimpdrawable-histogram.c
index 6ad2bd5..a65ceae 100644
--- a/app/core/gimpdrawable-histogram.c
+++ b/app/core/gimpdrawable-histogram.c
@@ -108,7 +108,7 @@ gimp_drawable_calculate_histogram (GimpDrawable  *drawable,
                                     gimp_drawable_get_buffer (drawable),
                                     GEGL_RECTANGLE (x, y, width, height),
                                     gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
-                                    GEGL_RECTANGLE (x - off_x, y - off_y,
+                                    GEGL_RECTANGLE (x + off_x, y + off_y,
                                                     width, height));
         }
       else
diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c
index 50dd2f8..6f50410 100644
--- a/app/core/gimphistogram.c
+++ b/app/core/gimphistogram.c
@@ -158,7 +158,7 @@ gimp_histogram_calculate (GimpHistogram       *histogram,
           switch (n_components)
             {
             case 1:
-              while (iter->length)
+              while (iter->length--)
                 {
                   const gdouble masked = *mask_data;
 
@@ -240,7 +240,7 @@ gimp_histogram_calculate (GimpHistogram       *histogram,
             case 2:
               while (iter->length--)
                 {
-                  const gdouble weight = data[1] / 255;
+                  const gdouble weight = data[1] / 255.0;
 
                   VALUE (0, data[0]) += weight;
                   VALUE (1, data[1]) += 1.0;
@@ -268,7 +268,7 @@ gimp_histogram_calculate (GimpHistogram       *histogram,
             case 4: /* calculate separate value values */
               while (iter->length--)
                 {
-                  const gdouble weight = data[3] / 255;
+                  const gdouble weight = data[3] / 255.0;
 
                   VALUE (1, data[0]) += weight;
                   VALUE (2, data[1]) += weight;


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