601 |
|
register unsigned char *dp; |
602 |
|
register int x, err; |
603 |
|
int y; |
604 |
< |
rgbpixel *inline; |
604 |
> |
rgbpixel *inl; |
605 |
|
short *cerr; |
606 |
|
|
607 |
< |
if ((inline = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL |
607 |
> |
if ((inl = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL |
608 |
|
|| (cerr = (short *)calloc(xmax,sizeof(short))) == NULL) |
609 |
|
quit("out of memory in getmono"); |
610 |
|
dp = ourdata - 1; |
611 |
|
for (y = 0; y < ymax; y++) { |
612 |
< |
picreadline3(y, inline); |
612 |
> |
picreadline3(y, inl); |
613 |
|
err = 0; |
614 |
|
for (x = 0; x < xmax; x++) { |
615 |
|
if (!(x&7)) |
616 |
|
*++dp = 0; |
617 |
< |
err += rgb_bright(&inline[x]) + cerr[x]; |
617 |
> |
err += rgb_bright(&inl[x]) + cerr[x]; |
618 |
|
if (err > 127) |
619 |
|
err -= 255; |
620 |
|
else |
622 |
|
cerr[x] = err >>= 1; |
623 |
|
} |
624 |
|
} |
625 |
< |
free((char *)inline); |
625 |
> |
free((char *)inl); |
626 |
|
free((char *)cerr); |
627 |
|
} |
628 |
|
|