--- ray/src/px/ximage.c 1989/11/29 16:50:39 1.15 +++ ray/src/px/ximage.c 1989/12/10 12:12:55 1.19 @@ -185,16 +185,6 @@ char *s; } -char * -sskip(s) /* skip a word */ -register char *s; -{ - while (isspace(*s)) s++; - while (*s && !isspace(*s)) s++; - return(s); -} - - init() /* get data and open window */ { register int i; @@ -384,10 +374,10 @@ XKeyEvent *ekey; switch (*cp) { case '\n': case '\r': /* radiance */ - sprintf(buf, "%-3g", intens(cval)/exposure); + sprintf(buf, "%.3f", intens(cval)/exposure); break; case 'l': /* luminance */ - sprintf(buf, "%-3gL", bright(cval)*683.0/exposure); + sprintf(buf, "%.0fn", bright(cval)*683.0/exposure); break; case 'c': /* color */ comp = pow(2.0, (double)scale); @@ -401,7 +391,7 @@ XKeyEvent *ekey; fontid, BlackPixel, WhitePixel); return(0); case 'i': /* identify (contour) */ - if (ourras->ncolors == 0) + if (ourras->pixels == NULL) return(-1); n = ourras->data.bz[ekey->x-xoff+BZPixmapSize(xmax,ekey->y-yoff)]; n = ourras->pmap[n]; @@ -444,8 +434,8 @@ XKeyEvent *ekey; /* fall through */ case CTRL(R): /* redraw */ case CTRL(L): + unmap_rcolors(ourras); XClear(wind); - XStoreColors(ourras->ncolors, ourras->cdefs); return(redraw(0, 0, width, height)); case ' ': /* clear */ return(redraw(box.xmin, box.ymin, box.xsiz, box.ysiz)); @@ -618,24 +608,26 @@ register XRASTER *xr; double sf; { register int i; - int maxv; + long maxv; + if (xr->pixels == NULL) + return; + sf = pow(sf, 1.0/gamcor); - maxv = (1<<16) / sf; + maxv = 65535/sf; for (i = xr->ncolors; i--; ) { - xr->cdefs[i].red = xr->cdefs[i].red >= maxv ? - (1<<16)-1 : + xr->cdefs[i].red = xr->cdefs[i].red > maxv ? + 65535 : xr->cdefs[i].red * sf; - xr->cdefs[i].green = xr->cdefs[i].green >= maxv ? - (1<<16)-1 : + xr->cdefs[i].green = xr->cdefs[i].green > maxv ? + 65535 : xr->cdefs[i].green * sf; - xr->cdefs[i].blue = xr->cdefs[i].blue >= maxv ? - (1<<16)-1 : + xr->cdefs[i].blue = xr->cdefs[i].blue > maxv ? + 65535 : xr->cdefs[i].blue * sf; } - if (xr->pixels != NULL) - XStoreColors(xr->ncolors, xr->cdefs); + XStoreColors(xr->ncolors, xr->cdefs); } @@ -668,9 +660,9 @@ register rgbpixel *l3; if (getscan(y) < 0) quiterr("cannot seek for picreadline"); /* convert scanline */ - if (scale != 0) + if (scale) for (i = 0; i < xmax; i++) - if (scanline[i][EXP]+scale >= 0) + if (scanline[i][EXP]) scanline[i][EXP] += scale; normcolrs(scanline, xmax); for (i = 0; i < xmax; i++) {