Re: [AD] color.c, finally!!! |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Ben Davis <ben@xxxxxxxxxx> wrote:
> > Er, where is it?
>
> Uhm, it's here. D'OH!
Hmm, I don't like the ugly goto hack. Can you confirm the
replacement patch?
--
SPUBBLING (SPUB ling), v. The superhuman feat of trying to wash one's
hands and manipulate the "water saving" faucets at the same time.
-- Rich Hall, "Sniglets"
Index: color.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/color.c,v
retrieving revision 1.3
diff -u -r1.3 color.c
--- color.c 2000/07/29 10:18:44 1.3
+++ color.c 2000/12/14 23:10:03
@@ -461,19 +461,23 @@
(((int)dist((r1), (g1), (b1), \
(pal1).r, (pal1).g, (pal1).b)) > (int)dist2)
- /* checking of possition */
+ /* checking of position */
#define dopos(rp, gp, bp, ts) \
if ((rp > -1 || r > 0) && (rp < 1 || r < 61) && \
(gp > -1 || g > 0) && (gp < 1 || g < 61) && \
(bp > -1 || b > 0) && (bp < 1 || b < 61)) { \
i = first + rp * 32 * 32 + gp * 32 + bp; \
- if (ts ? data[i] != val : !data[i]) { \
+ if (!data[i]) { \
+ data[i] = val; \
+ add1(i); \
+ } \
+ else if ((ts) && (data[i] != val)) { \
dist2 = (rp ? (col_diff+128)[(r+2*rp-pal[val].r) & 0x7F] : r2) + \
- (gp ? (col_diff)[(g+2*gp-pal[val].g) & 0x7F] : g2) + \
+ (gp ? (col_diff )[(g+2*gp-pal[val].g) & 0x7F] : g2) + \
(bp ? (col_diff+256)[(b+2*bp-pal[val].b) & 0x7F] : b2); \
if (better((r+2*rp), (g+2*gp), (b+2*bp), pal[data[i]])) { \
data[i] = val; \
- add1 (i); \
+ add1(i); \
} \
} \
}