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())) |
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) { |
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++) |
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 |
|
|
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]); |
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) |