chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixes to find_aa_density: MUST failures print p, deal with rounding problems in alpha...
[ypp-sc-tools.db-live.git]
/
pctb
/
structure.c
diff --git
a/pctb/structure.c
b/pctb/structure.c
index 139180878012d92ae6b0589c19d262c370a02a21..c54f89a13c35aa3a4b8bc7ef4dda73b1bc665fb3 100644
(file)
--- 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,
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) );
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 &&
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]); );
MRGB(here);MRGB(background);MRGB(foreground);MI(fg_extra);
MF(alpha_mean); MF(alpha[0]);MF(alpha[1]);MF(alpha[2]); );