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

Comparing ray/src/rt/rpict.c (file contents):
Revision 1.7 by greg, Tue Sep 12 12:28:26 1989 UTC vs.
Revision 1.8 by greg, Wed Sep 13 15:21:41 1989 UTC

# Line 49 | Line 49 | double  pctdone = 0.0;                 /* percentage done */
49  
50   extern long  nrays;                     /* number of rays traced */
51  
52 + static int  xres, yres;                 /* output x and y resolution */
53 +
54   #define  MAXDIV         32              /* maximum sample size */
55  
56   #define  pixjitter()    (.5+dstrpix*(.5-frandom()))
# Line 101 | Line 103 | char  *oldfile;
103                  psample = 1;
104          else if (psample > MAXDIV)
105                  psample = MAXDIV;
106 +                                        /* output resolution may be smaller */
107 +        xres = ourview.hresolu - (ourview.hresolu % psample);
108 +        yres = ourview.vresolu - (ourview.vresolu % psample);
109  
105        ourview.hresolu -= ourview.hresolu % psample;
106        ourview.vresolu -= ourview.vresolu % psample;
107                
110          for (i = 0; i <= psample; i++) {
111 <                scanbar[i] = (COLOR *)malloc((ourview.hresolu+1)*sizeof(COLOR));
111 >                scanbar[i] = (COLOR *)malloc((xres+1)*sizeof(COLOR));
112                  if (scanbar[i] == NULL)
113                          error(SYSTEM, "out of memory in render");
114          }
113        
115                                          /* write out boundaries */
116 <        fputresolu(YMAJOR|YDECR, ourview.hresolu, ourview.vresolu, stdout);
116 >        fputresolu(YMAJOR|YDECR, xres, yres, stdout);
117  
118 <        ypos = ourview.vresolu - salvage(oldfile);      /* find top line */
118 >        ypos = yres - salvage(oldfile); /* find top line */
119          fillscanline(scanbar[0], ypos, psample);        /* top scan */
120  
121          for (ypos -= psample; ypos > -psample; ypos -= psample) {
# Line 128 | Line 129 | char  *oldfile;
129                  fillscanbar(scanbar, ypos, psample);
130                  
131                  for (i = psample-1; i >= 0; i--)
132 <                        if (fwritescan(scanbar[i], ourview.hresolu, stdout) < 0)
132 >                        if (fwritescan(scanbar[i], xres, stdout) < 0)
133                                  goto writerr;
134                  if (fflush(stdout) == EOF)
135                          goto writerr;
136 <                pctdone = 100.0*(ourview.vresolu-ypos)/ourview.vresolu;
136 >                pctdone = 100.0*(yres-ypos)/yres;
137          }
138                  
139          for (i = 0; i <= psample; i++)
# Line 152 | Line 153 | int  y, xstep;
153          
154          pixvalue(scanline[0], 0, y);
155  
156 <        for (i = xstep; i <= ourview.hresolu; i += xstep) {
156 >        for (i = xstep; i <= xres; i += xstep) {
157          
158                  pixvalue(scanline[i], i, y);
159                  
# Line 169 | Line 170 | int  y, ysize;
170          int  b = ysize;
171          register int  i, j;
172          
173 <        for (i = 0; i < ourview.hresolu; i++) {
173 >        for (i = 0; i < xres; i++) {
174                  
175                  copycolor(vline[0], scanbar[0][i]);
176                  copycolor(vline[ysize], scanbar[ysize][i]);
# Line 270 | Line 271 | char  *oldfile;
271                  return(0);
272          }
273  
274 <        if (x != ourview.hresolu || y != ourview.vresolu) {
274 >        if (x != xres || y != yres) {
275                  sprintf(errmsg, "resolution mismatch in recover file \"%s\"",
276                                  oldfile);
277                  error(USER, errmsg);
278                  return(0);
279          }
280  
281 <        scanline = (COLR *)malloc(ourview.hresolu*sizeof(COLR));
281 >        scanline = (COLR *)malloc(xres*sizeof(COLR));
282          if (scanline == NULL)
283                  error(SYSTEM, "out of memory in salvage");
284 <        for (y = 0; y < ourview.vresolu; y++) {
285 <                if (freadcolrs(scanline, ourview.hresolu, fp) < 0)
284 >        for (y = 0; y < yres; y++) {
285 >                if (freadcolrs(scanline, xres, fp) < 0)
286                          break;
287 <                if (fwritecolrs(scanline, ourview.hresolu, stdout) < 0)
287 >                if (fwritecolrs(scanline, xres, stdout) < 0)
288                          goto writerr;
289          }
290          if (fflush(stdout) == EOF)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines