widgets: Fix RGB histogram pixel/count values

The RGB histogram shows three histograms overlaid on each other.
This multiples the pixel and count attributes by 3. To correct this,
the result of gimp_histogram_get_count () is divided by 3 for the
pixel and count displays.

(cherry picked from commit bf1e125138)
This commit is contained in:
Alx Sa 2023-06-14 21:09:21 +00:00
parent f911c6be2f
commit 9b6fa05fec

View file

@ -712,6 +712,14 @@ gimp_histogram_editor_info_update (GimpHistogramEditor *editor)
count = gimp_histogram_get_count (hist, view->channel,
view->start, view->end);
/* For the RGB histogram, we need to divide by three
* since it combines three histograms in one */
if (view->channel == GIMP_HISTOGRAM_RGB)
{
pixels /= 3;
count /= 3;
}
g_snprintf (text, sizeof (text), "%.3f",
gimp_histogram_get_mean (hist, view->channel,
view->start, view->end));