77 |
|
#ifdef CLOSEST |
78 |
|
closest(ncolors); /* ensure colors picked are closest */ |
79 |
|
#endif |
80 |
+ |
/* reset dithering function */ |
81 |
+ |
dith_colrs((BYTE *)NULL, (COLR *)NULL, 0); |
82 |
|
/* return new color table size */ |
83 |
|
return(ncolors); |
84 |
|
} |
109 |
|
register COLR *cs; |
110 |
|
int n; |
111 |
|
{ |
112 |
< |
static short (*cerr)[3]; |
112 |
> |
static short (*cerr)[3] = NULL; |
113 |
|
static int N = 0; |
114 |
|
int err[3], errp[3]; |
115 |
|
register int x, i; |
116 |
|
|
117 |
|
if (n != N) { /* get error propogation array */ |
118 |
< |
if (N) |
119 |
< |
cerr = (short (*)[3])realloc((char *)cerr, |
120 |
< |
3*n*sizeof(short)); |
121 |
< |
else |
118 |
> |
if (N) { |
119 |
> |
free((char *)cerr); |
120 |
> |
cerr = NULL; |
121 |
> |
} |
122 |
> |
if (n) |
123 |
|
cerr = (short (*)[3])malloc(3*n*sizeof(short)); |
124 |
|
if (cerr == NULL) { |
125 |
|
N = 0; |