--- ray/src/px/ximage.c 1989/09/13 15:41:52 1.10 +++ ray/src/px/ximage.c 1989/10/23 09:10:22 1.13 @@ -38,7 +38,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define BORWIDTH 5 /* border width */ #define BARHEIGHT 25 /* menu bar size */ -double gamcor = 2.0; /* gamma correction */ +double gamcor = 2.2; /* gamma correction */ XRASTER *ourras = NULL; /* our stored raster image */ @@ -144,10 +144,12 @@ char *argv[]; if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) quiterr("bad picture size"); /* set view parameters */ - if (gotview) + if (gotview) { + ourview.hresolu = xmax; + ourview.vresolu = ymax; if (setview(&ourview) != NULL) gotview = 0; - + } if ((scanline = (COLR *)malloc(xmax*sizeof(COLR))) == NULL) quiterr("out of memory"); @@ -646,35 +648,16 @@ picreadline3(y, l3) /* read in 3-byte scanline */ int y; register rgbpixel *l3; { - register BYTE *l4; - register int shift, c; - int i; - + register int i; + /* read scanline */ if (getscan(y) < 0) quiterr("cannot seek for picreadline"); /* convert scanline */ - for (l4=scanline[0], i=xmax; i--; l4+=4, l3++) { - shift = l4[EXP] - COLXS + scale; - if (shift >= 8) { - l3->r = l3->g = l3->b = 255; - } else if (shift <= -8) { - l3->r = l3->g = l3->b = 0; - } else if (shift > 0) { - c = l4[RED] << shift; - l3->r = c > 255 ? 255 : c; - c = l4[GRN] << shift; - l3->g = c > 255 ? 255 : c; - c = l4[BLU] << shift; - l3->b = c > 255 ? 255 : c; - } else if (shift < 0) { - l3->r = l4[RED] >> -shift; - l3->g = l4[GRN] >> -shift; - l3->b = l4[BLU] >> -shift; - } else { - l3->r = l4[RED]; - l3->g = l4[GRN]; - l3->b = l4[BLU]; - } + normcolrs(scanline, xmax); + for (i = 0; i < xmax; i++) { + l3[i].r = scanline[i][RED]; + l3[i].g = scanline[i][GRN]; + l3[i].b = scanline[i][BLU]; } }