fix some minro roundoff problems as before...

SVN revision: 1093
This commit is contained in:
Carsten Haitzler 1999-11-01 10:07:13 +00:00
parent 73b408fc3d
commit ed7f89ca74
3 changed files with 21 additions and 21 deletions

20
grad.c
View File

@ -154,7 +154,7 @@ ng = gg + ((tmp + (tmp >> 8) + 0x80) >> 8);\
tmp = ((b1) - bb) * (a1);\
nb = bb + ((tmp + (tmp >> 8) + 0x80) >> 8);\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;
#define BLEND_ADD(r1, g1, b1, a1, dest) \
@ -163,13 +163,13 @@ gg = ((dest) >> 8 ) & 0xff;\
rr = ((dest) >> 16) & 0xff;\
aa = ((dest) >> 24) & 0xff;\
tmp = rr + (((r1) * (a1)) >> 8);\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 9))) & 0xff;\
tmp = gg + (((g1) * (a1)) >> 8);\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 9))) & 0xff;\
tmp = bb + (((b1) * (a1)) >> 8);\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 9))) & 0xff;\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;
#define BLEND_SUB(r1, g1, b1, a1, dest) \
@ -184,7 +184,7 @@ ng = tmp & (~(tmp >> 8));\
tmp = bb - (((b1) * (a1)) >> 8);\
nb = tmp & (~(tmp >> 8));\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;
#define BLEND_RE(r1, g1, b1, a1, dest) \
@ -193,13 +193,13 @@ gg = ((dest) >> 8 ) & 0xff;\
rr = ((dest) >> 16) & 0xff;\
aa = ((dest) >> 24) & 0xff;\
tmp = rr + ((((r1) - 127) * (a1)) >> 7);\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 8));\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 9)) & 0xff;\
tmp = gg + ((((g1) - 127) * (a1)) >> 7);\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 8));\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 9)) & 0xff;\
tmp = bb + ((((b1) - 127) * (a1)) >> 7);\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 8));\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 9)) & 0xff;\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;
void

2
main.c
View File

@ -316,7 +316,7 @@ int main (int argc, char **argv)
}
imlib_image_fill_color_range_rectangle(im, 60, 60, 256, 256,
rg, (double)x,
IMLIB_OP_COPY);
IMLIB_OP_RESHADE);
up = imlib_update_append_rect(up, 60, 60, 256, 256);
}
if (fon)

View File

@ -364,7 +364,7 @@ ng = gg + ((tmp + (tmp >> 8) + 0x80) >> 8);\
tmp = ((b1) - bb) * (a1);\
nb = bb + ((tmp + (tmp >> 8) + 0x80) >> 8);\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;
#define BLEND_ADD(r1, g1, b1, a1, dest) \
@ -373,13 +373,13 @@ gg = ((dest) >> 8 ) & 0xff;\
rr = ((dest) >> 16) & 0xff;\
aa = ((dest) >> 24) & 0xff;\
tmp = rr + (((r1) * (a1)) >> 8);\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 9))) & 0xff;\
tmp = gg + (((g1) * (a1)) >> 8);\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 9))) & 0xff;\
tmp = bb + (((b1) * (a1)) >> 8);\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 9))) & 0xff;\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;
#define BLEND_SUB(r1, g1, b1, a1, dest) \
@ -394,7 +394,7 @@ ng = tmp & (~(tmp >> 8));\
tmp = bb - (((b1) * (a1)) >> 8);\
nb = tmp & (~(tmp >> 8));\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;
#define BLEND_RE(r1, g1, b1, a1, dest) \
@ -403,13 +403,13 @@ gg = ((dest) >> 8 ) & 0xff;\
rr = ((dest) >> 16) & 0xff;\
aa = ((dest) >> 24) & 0xff;\
tmp = rr + ((((r1) - 127) * (a1)) >> 7);\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 8));\
nr = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 9)) & 0xff;\
tmp = gg + ((((g1) - 127) * (a1)) >> 7);\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 8));\
ng = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 9)) & 0xff;\
tmp = bb + ((((b1) - 127) * (a1)) >> 7);\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 8));\
nb = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 9)) & 0xff;\
tmp = (a1) + aa;\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 8)));\
na = (tmp | ((tmp & 256) - ((tmp & 256) >> 9)));\
(dest) = (na << 24) | (nr << 16) | (ng << 8) | nb;