[gimp] Issue #4205 - The histogram dock scale is incorrect when an image is opened
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #4205 - The histogram dock scale is incorrect when an image is opened
- Date: Mon, 11 Nov 2019 16:17:59 +0000 (UTC)
commit 0c899394b4b95b8f25b3d73c6d3cff2cd700be6c
Author: Ell <ell_se yahoo com>
Date: Mon Nov 11 18:11:39 2019 +0200
Issue #4205 - The histogram dock scale is incorrect when an image is opened
In gimp_histogram_view_update_bins(), don't update the view's
range if there's no histogram or the histogram is empty, to avoid
discarding the existing range. Additionally, improve the range
readjustment when the number of bins changes.
app/widgets/gimphistogramview.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c
index 60b328e557..b262440070 100644
--- a/app/widgets/gimphistogramview.c
+++ b/app/widgets/gimphistogramview.c
@@ -844,21 +844,21 @@ gimp_histogram_view_notify (GimpHistogram *histogram,
static void
gimp_histogram_view_update_bins (GimpHistogramView *view)
{
- gint new_bins = 256;
+ gint new_bins = 0;
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);
- if (new_bins != view->n_bins)
+ if (new_bins > 0 && new_bins != view->n_bins)
{
- view->start = ROUND (((gdouble) view->start *
- (new_bins - 1) /
- (view->n_bins - 1)));
- view->end = ROUND (((gdouble) view->end *
- (new_bins - 1) /
- (view->n_bins - 1)));
+ view->start = MIN (ROUND ((gdouble) view->start *
+ new_bins / view->n_bins),
+ new_bins - 1);
+ view->end = MAX (ROUND ((gdouble) (view->end + 1) *
+ new_bins / view->n_bins) - 1,
+ 0);
view->n_bins = new_bins;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]