308 |
|
if (ourras == NULL) |
309 |
|
goto fail; |
310 |
|
getmono(); |
311 |
< |
} else if (XMatchVisualInfo(thedisplay,ourscreen,24,TrueColor,&vinfo)) { |
311 |
> |
} else if (XMatchVisualInfo(thedisplay,ourscreen,24,TrueColor,&vinfo) |
312 |
> |
/* kludge for DirectColor */ |
313 |
> |
|| XMatchVisualInfo(thedisplay,ourscreen,24,DirectColor,&vinfo)) { |
314 |
|
ourdata = (unsigned char *)malloc(xmax*ymax*3); |
315 |
|
if (ourdata == NULL) |
316 |
|
goto fail; |
603 |
|
register unsigned char *dp; |
604 |
|
register int x, err; |
605 |
|
int y; |
606 |
< |
rgbpixel *inline; |
606 |
> |
rgbpixel *inl; |
607 |
|
short *cerr; |
608 |
|
|
609 |
< |
if ((inline = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL |
609 |
> |
if ((inl = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL |
610 |
|
|| (cerr = (short *)calloc(xmax,sizeof(short))) == NULL) |
611 |
|
quit("out of memory in getmono"); |
612 |
|
dp = ourdata - 1; |
613 |
|
for (y = 0; y < ymax; y++) { |
614 |
< |
picreadline3(y, inline); |
614 |
> |
picreadline3(y, inl); |
615 |
|
err = 0; |
616 |
|
for (x = 0; x < xmax; x++) { |
617 |
|
if (!(x&7)) |
618 |
|
*++dp = 0; |
619 |
< |
err += rgb_bright(&inline[x]) + cerr[x]; |
619 |
> |
err += rgb_bright(&inl[x]) + cerr[x]; |
620 |
|
if (err > 127) |
621 |
|
err -= 255; |
622 |
|
else |
624 |
|
cerr[x] = err >>= 1; |
625 |
|
} |
626 |
|
} |
627 |
< |
free((char *)inline); |
627 |
> |
free((char *)inl); |
628 |
|
free((char *)cerr); |
629 |
|
} |
630 |
|
|