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.
This commit is contained in:
Michael Natterer 2013-06-11 23:11:37 +02:00
parent d26cd268ba
commit 0f0590426d
1 changed files with 3 additions and 1 deletions

View File

@ -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))
{