From 0f0590426df546e0fe8fa46ea696b9614d939278 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 11 Jun 2013 23:11:37 +0200 Subject: [PATCH] app: must CLAMP() all valus to 0..1 for calculating histogram bins The histogram does only 0..1, there are no bins outside that range. --- app/core/gimphistogram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c index a403c82739..f87a8b1e70 100644 --- a/app/core/gimphistogram.c +++ b/app/core/gimphistogram.c @@ -307,7 +307,9 @@ gimp_histogram_calculate (GimpHistogram *histogram, babl_format ("Y float"), GEGL_BUFFER_READ, GEGL_ABYSS_NONE); -#define VALUE(c,i) (priv->values[(c) * priv->n_bins + (gint) ((i) * (priv->n_bins - 0.0001))]) +#define VALUE(c,i) (priv->values[(c) * priv->n_bins + \ + (gint) (CLAMP ((i), 0.0, 1.0) * \ + (priv->n_bins - 0.0001))]) while (gegl_buffer_iterator_next (iter)) {