--- ray/src/common/image.c 1990/01/09 09:08:09 1.6 +++ ray/src/common/image.c 1990/01/16 16:21:07 1.9 @@ -65,15 +65,13 @@ register VIEW *v; } -normaspect(vp, ap, xp, yp) /* fix pixel aspect or resolution */ -VIEW *vp; -double *ap; -int *xp, *yp; +normaspect(va, ap, xp, yp) /* fix pixel aspect or resolution */ +double va; /* view aspect ratio */ +double *ap; /* pixel aspect in (or out if 0) */ +int *xp, *yp; /* x and y resolution in (or out if *ap!=0) */ { - double va = viewaspect(vp); - if (*ap <= FTINY) - *ap = (double)*yp / *xp / va; /* compute pixel aspect */ + *ap = va * *xp / *yp; /* compute pixel aspect */ else if (va * *xp > *ap * *yp) *xp = *yp / va * *ap; /* reduce x resolution */ else @@ -145,7 +143,7 @@ register char *av[]; #define check(c,n) if ((av[0][c]&&av[0][c]!=' ') || n>=ac) return(-1) extern double atof(); - if (av[0][0] != '-' || av[0][1] != 'v') + if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v') return(-1); switch (av[0][2]) { case 't': /* type */ @@ -207,7 +205,7 @@ register char *s; while (*s == ' ') s++; - do { + while (*s) { ac = 0; do { av[ac++] = s; @@ -220,8 +218,9 @@ register char *s; if (na+1 < ac) s = av[na+1]; nvopts++; - } - } while (*s); + } else if (ac > 1) + s = av[1]; + } return(nvopts); } @@ -235,7 +234,7 @@ FILE *fp; fprintf(fp, " -vd %.6g %.6g %.6g", vp->vdir[0], vp->vdir[1], vp->vdir[2]); fprintf(fp, " -vu %.6g %.6g %.6g", vp->vup[0], vp->vup[1], vp->vup[2]); fprintf(fp, " -vh %.6g -vv %.6g", vp->horiz, vp->vert); - fprintf(fp, " -vs %d -vl %d", vp->hoff, vp->voff); + fprintf(fp, " -vs %.6g -vl %.6g", vp->hoff, vp->voff); } @@ -260,9 +259,10 @@ char *s; int -viewfile(fname, vp) /* get view from file */ +viewfile(fname, vp, xp, yp) /* get view from file */ char *fname; VIEW *vp; +int *xp, *yp; { extern char *progname; FILE *fp; @@ -275,6 +275,10 @@ VIEW *vp; gothview = 0; getheader(fp, gethview); + + if (xp != NULL && yp != NULL + && fgetresolu(xp, yp, fp) == -1) + gothview = 0; fclose(fp);