80 |
|
seqstart = atoi(argv[++i]); |
81 |
|
break; |
82 |
|
case 'v': /* view file */ |
83 |
< |
if (argv[i][1]!='f' || badarg(argc-i-1,argv+i+1,"s")) |
83 |
> |
if (argv[i][2]!='f' || badarg(argc-i-1,argv+i+1,"s")) |
84 |
|
goto userr; |
85 |
|
rval = viewfile(argv[++i], &myview, NULL); |
86 |
|
if (rval < 0) { |
220 |
|
int |
221 |
|
endpicture() /* finish and write out pixels */ |
222 |
|
{ |
223 |
< |
int nunrend = 0; |
224 |
< |
int v; |
223 |
> |
int lastr = -1, nunrend = 0; |
224 |
> |
int4 lastp, lastrp; |
225 |
> |
register int4 p; |
226 |
|
register double d; |
226 |
– |
register int p; |
227 |
|
/* compute final pixel values */ |
228 |
|
for (p = hres*vres; p--; ) { |
229 |
|
if (myweight[p] <= FTINY) { |
230 |
+ |
if (lastr >= 0) |
231 |
+ |
if (p/hres == lastp/hres) |
232 |
+ |
copycolor(mypixel[p], mypixel[lastp]); |
233 |
+ |
else |
234 |
+ |
copycolor(mypixel[p], mypixel[lastrp]); |
235 |
|
nunrend++; |
236 |
|
continue; |
237 |
|
} |
238 |
|
d = expval/myweight[p]; |
239 |
|
scalecolor(mypixel[p], d); |
240 |
+ |
if ((lastp=p)/hres != lastr) |
241 |
+ |
lastr = (lastrp=p)/hres; |
242 |
|
} |
243 |
|
/* write each scanline */ |
244 |
< |
for (v = vres; v--; ) |
245 |
< |
if (fwritescan(mypixel+v*hres, hres, stdout) < 0) |
244 |
> |
for (p = vres; p--; ) |
245 |
> |
if (fwritescan(mypixel+p*hres, hres, stdout) < 0) |
246 |
|
return(-1); |
247 |
|
if (fflush(stdout) == EOF) |
248 |
|
return(-1); |