app: GimpHistogramView: fix display when the number of bins changes

Also look at "bg_histogram", but only if "histogram" is not set. Fixes
curves tool display after changing image precision.
This commit is contained in:
Michael Natterer 2013-06-15 20:29:42 +02:00
parent 731360a8f7
commit 3fb16c8849
1 changed files with 9 additions and 1 deletions

View File

@ -688,6 +688,9 @@ gimp_histogram_view_set_background (GimpHistogramView *view,
{
g_object_ref (histogram);
if (view->n_bins != gimp_histogram_n_bins (histogram))
gimp_histogram_view_update_bins (view);
if (view->channel >= gimp_histogram_n_channels (histogram))
gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
}
@ -792,7 +795,12 @@ gimp_histogram_view_notify (GimpHistogram *histogram,
static void
gimp_histogram_view_update_bins (GimpHistogramView *view)
{
gint new_bins = gimp_histogram_n_bins (view->histogram);
gint new_bins;
if (view->histogram)
new_bins = gimp_histogram_n_bins (view->histogram);
else if (view->bg_histogram)
new_bins = gimp_histogram_n_bins (view->bg_histogram);
view->start = ROUND (((gdouble) view->start *
(new_bins - 1) /