mirror of https://github.com/GNOME/gimp.git
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
This commit is contained in:
parent
3643551280
commit
0909a30b06
|
@ -108,7 +108,7 @@ gimp_drawable_calculate_histogram (GimpDrawable *drawable,
|
||||||
gimp_drawable_get_buffer (drawable),
|
gimp_drawable_get_buffer (drawable),
|
||||||
GEGL_RECTANGLE (x, y, width, height),
|
GEGL_RECTANGLE (x, y, width, height),
|
||||||
gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
|
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));
|
width, height));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -158,7 +158,7 @@ gimp_histogram_calculate (GimpHistogram *histogram,
|
||||||
switch (n_components)
|
switch (n_components)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
while (iter->length)
|
while (iter->length--)
|
||||||
{
|
{
|
||||||
const gdouble masked = *mask_data;
|
const gdouble masked = *mask_data;
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ gimp_histogram_calculate (GimpHistogram *histogram,
|
||||||
case 2:
|
case 2:
|
||||||
while (iter->length--)
|
while (iter->length--)
|
||||||
{
|
{
|
||||||
const gdouble weight = data[1] / 255;
|
const gdouble weight = data[1] / 255.0;
|
||||||
|
|
||||||
VALUE (0, data[0]) += weight;
|
VALUE (0, data[0]) += weight;
|
||||||
VALUE (1, data[1]) += 1.0;
|
VALUE (1, data[1]) += 1.0;
|
||||||
|
@ -268,7 +268,7 @@ gimp_histogram_calculate (GimpHistogram *histogram,
|
||||||
case 4: /* calculate separate value values */
|
case 4: /* calculate separate value values */
|
||||||
while (iter->length--)
|
while (iter->length--)
|
||||||
{
|
{
|
||||||
const gdouble weight = data[3] / 255;
|
const gdouble weight = data[3] / 255.0;
|
||||||
|
|
||||||
VALUE (1, data[0]) += weight;
|
VALUE (1, data[0]) += weight;
|
||||||
VALUE (2, data[1]) += weight;
|
VALUE (2, data[1]) += weight;
|
||||||
|
|
Loading…
Reference in New Issue