[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Forwarded from Ben Davis:
> I've corrected the bug again, manually, and the new file
> is attached. This time it has all the AL_CONSTs and everything.
I've attached the patch. COuld someone apply it to the CVS pls?
Use:
C:\DJGPP> patch -p0 < color.diff
I'm assuming Allegro is under djgpp.
--
- Robert J Ohannessian
--- /cvs/allegro/src/color.c Sat Jul 29 06:18:44 2000
+++ allegro/src/color.c Sat Nov 25 14:48:48 2000
@@ -21,6 +21,8 @@
*
* Sven Sandberg optimised the create_light_table() function.
*
+ * Ben Davis fixed a minor bug in create_rgb_table().
+ *
* See readme.txt for copyright information.
*/
@@ -462,16 +464,18 @@
(pal1).r, (pal1).g, (pal1).b)) > (int)dist2)
/* checking of possition */
- #define dopos(rp, gp, bp, ts) \
+ #define dopos(n, 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] == 0) goto nodistancecheck ## n; \
+ if (ts ? data[i] != val : 1) { \
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]])) { \
+ nodistancecheck ## n: \
data[i] = val; \
add1 (i); \
} \
@@ -516,12 +520,12 @@
b2 = (col_diff+256)[((pal[val].b)-(b)) & 0x7F];
/* try to grow to all directions */
- dopos( 0, 0, 1, 1);
- dopos( 0, 0,-1, 1);
- dopos( 1, 0, 0, 1);
- dopos(-1, 0, 0, 1);
- dopos( 0, 1, 0, 1);
- dopos( 0,-1, 0, 1);
+ dopos( 1, 0, 0, 1, 1);
+ dopos( 2, 0, 0,-1, 1);
+ dopos( 3, 1, 0, 0, 1);
+ dopos( 4,-1, 0, 0, 1);
+ dopos( 5, 0, 1, 0, 1);
+ dopos( 6, 0,-1, 0, 1);
/* faster growing of blue direction */
if ((b > 0) && (data[first-1] == val)) {
@@ -529,10 +533,10 @@
first--;
b2 = (col_diff+256)[((pal[val].b)-(b)) & 0x7F];
- dopos(-1, 0, 0, 0);
- dopos( 1, 0, 0, 0);
- dopos( 0,-1, 0, 0);
- dopos( 0, 1, 0, 0);
+ dopos( 7,-1, 0, 0, 0);
+ dopos( 8, 1, 0, 0, 0);
+ dopos( 9, 0,-1, 0, 0);
+ dopos(10, 0, 1, 0, 0);
first++;
}
@@ -551,22 +555,22 @@
g2 = (col_diff )[((pal[val].g)-(g)) & 0x7F];
b2 = (col_diff+256)[((pal[val].b)-(b)) & 0x7F];
- dopos( 0, 0, 1, 1);
- dopos( 0, 0,-1, 1);
- dopos( 1, 0, 0, 1);
- dopos(-1, 0, 0, 1);
- dopos( 0, 1, 0, 1);
- dopos( 0,-1, 0, 1);
+ dopos(11, 0, 0, 1, 1);
+ dopos(12, 0, 0,-1, 1);
+ dopos(13, 1, 0, 0, 1);
+ dopos(14,-1, 0, 0, 1);
+ dopos(15, 0, 1, 0, 1);
+ dopos(16, 0,-1, 0, 1);
if ((b < 61) && (data[first + 1] == val)) {
b += 2;
first++;
b2 = (col_diff+256)[((pal[val].b)-(b)) & 0x7f];
- dopos(-1, 0, 0, 0);
- dopos( 1, 0, 0, 0);
- dopos( 0,-1, 0, 0);
- dopos( 0, 1, 0, 0);
+ dopos(17,-1, 0, 0, 0);
+ dopos(18, 1, 0, 0, 0);
+ dopos(19, 0,-1, 0, 0);
+ dopos(20, 0, 1, 0, 0);
first--;
}