ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/image.c
(Generate patch)

Comparing ray/src/common/image.c (file contents):
Revision 1.6 by greg, Tue Jan 9 09:08:09 1990 UTC vs.
Revision 1.9 by greg, Tue Jan 16 16:21:07 1990 UTC

# Line 65 | Line 65 | register VIEW  *v;
65   }
66  
67  
68 < normaspect(vp, ap, xp, yp)              /* fix pixel aspect or resolution */
69 < VIEW  *vp;
70 < double  *ap;
71 < int  *xp, *yp;
68 > normaspect(va, ap, xp, yp)              /* fix pixel aspect or resolution */
69 > double  va;                     /* view aspect ratio */
70 > double  *ap;                    /* pixel aspect in (or out if 0) */
71 > int  *xp, *yp;                  /* x and y resolution in (or out if *ap!=0) */
72   {
73        double  va = viewaspect(vp);
74
73          if (*ap <= FTINY)
74 <                *ap = (double)*yp / *xp / va;   /* compute pixel aspect */
74 >                *ap = va * *xp / *yp;           /* compute pixel aspect */
75          else if (va * *xp > *ap * *yp)
76                  *xp = *yp / va * *ap;           /* reduce x resolution */
77          else
# Line 145 | Line 143 | register char  *av[];
143   #define check(c,n)      if ((av[0][c]&&av[0][c]!=' ') || n>=ac) return(-1)
144          extern double  atof();
145  
146 <        if (av[0][0] != '-' || av[0][1] != 'v')
146 >        if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v')
147                  return(-1);
148          switch (av[0][2]) {
149          case 't':                       /* type */
# Line 207 | Line 205 | register char  *s;
205  
206          while (*s == ' ')
207                  s++;
208 <        do {
208 >        while (*s) {
209                  ac = 0;
210                  do {
211                          av[ac++] = s;
# Line 220 | Line 218 | register char  *s;
218                          if (na+1 < ac)
219                                  s = av[na+1];
220                          nvopts++;
221 <                }
222 <        } while (*s);
221 >                } else if (ac > 1)
222 >                        s = av[1];
223 >        }
224          return(nvopts);
225   }
226  
# Line 235 | Line 234 | FILE  *fp;
234          fprintf(fp, " -vd %.6g %.6g %.6g", vp->vdir[0], vp->vdir[1], vp->vdir[2]);
235          fprintf(fp, " -vu %.6g %.6g %.6g", vp->vup[0], vp->vup[1], vp->vup[2]);
236          fprintf(fp, " -vh %.6g -vv %.6g", vp->horiz, vp->vert);
237 <        fprintf(fp, " -vs %d -vl %d", vp->hoff, vp->voff);
237 >        fprintf(fp, " -vs %.6g -vl %.6g", vp->hoff, vp->voff);
238   }
239  
240  
# Line 260 | Line 259 | char  *s;
259  
260  
261   int
262 < viewfile(fname, vp)                     /* get view from file */
262 > viewfile(fname, vp, xp, yp)             /* get view from file */
263   char  *fname;
264   VIEW  *vp;
265 + int  *xp, *yp;
266   {
267          extern char  *progname;
268          FILE  *fp;
# Line 275 | Line 275 | VIEW  *vp;
275          gothview = 0;
276  
277          getheader(fp, gethview);
278 +
279 +        if (xp != NULL && yp != NULL
280 +                        && fgetresolu(xp, yp, fp) == -1)
281 +                gothview = 0;
282  
283          fclose(fp);
284  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines