diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-07-13 21:12:47 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:33 +0100 |
commit | c60408eea2fcbab40e79d11f0a79691dd49a4a87 (patch) | |
tree | dceaed116e022edc039a6c3ba4ea28ee28f3799e /src | |
parent | 7d86814aaf05835724154dc64f9907898b419c3a (diff) |
Avoid more histogram silliness
Diffstat (limited to 'src')
-rw-r--r-- | src/scaling-report.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/scaling-report.c b/src/scaling-report.c index 2cfafd09..70bc78ad 100644 --- a/src/scaling-report.c +++ b/src/scaling-report.c @@ -418,17 +418,21 @@ static void scale_factor_histogram(cairo_t *cr, const struct image *images, } } - /* Count the number of bins with no counts, subtract 1 from - * the maximum value until this isn't the case */ n_zero = 0; n_half = 0; - for ( b=0; b<nbins; b++ ) { - if ( counts[b] == 0 ) n_zero++; - n_half++; - } - n_half /= 2; + if ( osf_max > 10.0 ) { - if ( n_zero > n_half ) osf_max -= 1.0; + /* Count the number of bins with no counts, subtract 1 + * from the maximum value until this isn't the case */ + for ( b=0; b<nbins; b++ ) { + if ( counts[b] == 0 ) n_zero++; + n_half++; + } + n_half /= 2; + + if ( n_zero > n_half ) osf_max -= 1.0; + + } } while ( n_zero > n_half ); |