--- ray/src/px/x11image.c 1992/10/22 17:51:05 2.16 +++ ray/src/px/x11image.c 1992/11/11 17:34:08 2.18 @@ -782,8 +782,7 @@ COLR *scan; static short cerr[ICONSIZ]; static int ynext; static char *dp; - double sf; - COLOR col; + COLR clr; register int err; register int x, ti; int errp; @@ -808,17 +807,15 @@ COLR *scan; } if (y < ynext*ymax/iconheight) /* skip this one */ return; - sf = pow(2.0, (double)(scale+8)); err = 0; for (x = 0; x < iconwidth; x++) { if (!(x&7)) *++dp = 0; errp = err; ti = x*xmax/iconwidth; - colr_color(col, scan[ti]); - ti = sf*bright(col); - if (ti > 255) ti = 255; - err += ti + cerr[x]; + copycolr(clr, scan[ti]); + normcolrs(clr, 1, scale); + err += normbright(clr) + cerr[x]; if (err > 127) err -= 255; else @@ -873,18 +870,20 @@ getgrey() /* get greyscale data */ add2icon(y, scanline); if (scale) shiftcolrs(scanline, xmax, scale); + for (x = 0; x < xmax; x++) + scanline[x][GRN] = normbright(scanline[x]); colrs_gambs(scanline, xmax); if (maxcolors < 256) for (x = 0; x < xmax; x++) - *dp++ = ((long)normbright(scanline[x]) * - maxcolors + 128) >> 8; + *dp++ = ((long)scanline[x][GRN] * + maxcolors + maxcolors/2) >> 8; else for (x = 0; x < xmax; x++) - *dp++ = normbright(scanline[x]); + *dp++ = scanline[x][GRN]; } for (x = 0; x < maxcolors; x++) clrtab[x][RED] = clrtab[x][GRN] = - clrtab[x][BLU] = ((long)x*256+maxcolors/2)/maxcolors; + clrtab[x][BLU] = ((long)x*256 + 128)/maxcolors; }