--- ray/src/px/ximage.c 1989/05/11 08:25:21 1.6 +++ ray/src/px/ximage.c 1989/09/13 15:41:52 1.10 @@ -141,15 +141,13 @@ char *argv[]; /* get header */ getheader(fin, headline); /* get picture dimensions */ - if (fscanf(fin, "-Y %d +X %d\n", &ymax, &xmax) != 2) + if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) quiterr("bad picture size"); /* set view parameters */ - if (gotview) { - ourview.hresolu = xmax; - ourview.vresolu = ymax; + if (gotview) if (setview(&ourview) != NULL) gotview = 0; - } + if ((scanline = (COLR *)malloc(xmax*sizeof(COLR))) == NULL) quiterr("out of memory"); @@ -345,7 +343,7 @@ redraw(x, y, w, h) /* redraw section of window */ int x, y; int w, h; { - if (map_rcolors(ourras) == NULL) { + if (ourras->ncolors && map_rcolors(ourras) == NULL) { fprintf(stderr, "%s: cannot allocate colors\n", progname); return(-1); } @@ -689,7 +687,7 @@ pixel *l; } -picreadcm(map) /* do gamcor correction */ +picreadcm(map) /* do gamma correction */ colormap map; { extern double pow();