[gimp] app: GimpHistogramView: fix display when the number of bins changes



commit 3fb16c8849922930a3a91cec0ab4117d396960b0
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jun 15 20:29:42 2013 +0200

    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.

 app/widgets/gimphistogramview.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c
index 39b5ba7..c7a7153 100644
--- a/app/widgets/gimphistogramview.c
+++ b/app/widgets/gimphistogramview.c
@@ -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) /


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]