From: Ian Jackson Date: Sun, 5 Jul 2009 18:10:50 +0000 (+0100) Subject: fixes to find_aa_density: MUST failures print p, deal with rounding problems in alpha... X-Git-Tag: 1.9.3~9 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=commitdiff_plain;h=41ac8cfeadd4eac0927b8fce086c805c2753ba77 fixes to find_aa_density: MUST failures print p, deal with rounding problems in alpha_mean; fix range end test for alpha_mean --- 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]); );