From 41ac8cfeadd4eac0927b8fce086c805c2753ba77 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 5 Jul 2009 19:10:50 +0100 Subject: [PATCH] fixes to find_aa_density: MUST failures print p, deal with rounding problems in alpha_mean; fix range end test for alpha_mean --- pctb/structure.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pctb/structure.c b/pctb/structure.c index 1391808..c54f89a 100644 --- a/pctb/structure.c +++ b/pctb/structure.c @@ -486,11 +486,16 @@ static double find_aa_density(const RgbImage *ri, Point p, long background, double alpha_max= alpha_mean + thresh; for (i=0; i<3; i++) MUST( alpha_min <= alpha[i] && alpha[i] <= alpha_max, + MP(p); MRGB(here);MRGB(background);MRGB(foreground);MI(fg_extra); MF(alpha_min); MI(i);MF(alpha[i]);MF(alpha_max) ); + if ( -1e-5 < alpha_mean && alpha_mean <= 0.0 ) alpha_mean= 0.0; + if (1.0 <= alpha_mean && alpha_mean <= 1.0+1e-5) alpha_mean= 1.0; + MUST( 0 <= alpha_mean && - (fg_extra ? alpha_mean < 0.999 : alpha_mean >= 1.0), + (fg_extra ? (alpha_mean < 0.999) : (alpha_mean <= 1.0)), + MP(p); MRGB(here);MRGB(background);MRGB(foreground);MI(fg_extra); MF(alpha_mean); MF(alpha[0]);MF(alpha[1]);MF(alpha[2]); ); -- 2.30.2