18 |
|
|
19 |
|
#include "random.h" |
20 |
|
|
21 |
+ |
#ifndef WFLUSH |
22 |
+ |
#define WFLUSH 30 /* flush after this many rays */ |
23 |
+ |
#endif |
24 |
|
|
25 |
+ |
|
26 |
|
getrect(s, r) /* get a box */ |
27 |
|
char *s; |
28 |
|
register RECT *r; |
134 |
|
register PNODE *p; |
135 |
|
int xmin, ymin, xmax, ymax; |
136 |
|
{ |
137 |
+ |
extern long nrays; |
138 |
+ |
static long lastflush = 0; |
139 |
|
static RAY thisray; |
140 |
|
double h, v; |
141 |
|
register int i; |
163 |
|
scalecolor(p->v, exposure); |
164 |
|
|
165 |
|
(*dev->paintr)(greyscale?greyof(p->v):p->v, xmin, ymin, xmax, ymax); |
166 |
+ |
|
167 |
+ |
if (dev->flush != NULL && nrays - lastflush >= WFLUSH) { |
168 |
+ |
lastflush = nrays; |
169 |
+ |
(*dev->flush)(); |
170 |
+ |
} |
171 |
|
} |
172 |
|
|
173 |
|
|
176 |
|
/* free old image */ |
177 |
|
freepkids(&ptrunk); |
178 |
|
/* compute resolution */ |
179 |
< |
if (viewaspect(&ourview)*dev->xsiz > dev->pixaspect*dev->ysiz) { |
180 |
< |
vresolu = dev->ysiz; |
181 |
< |
hresolu = vresolu/viewaspect(&ourview)*dev->pixaspect; |
171 |
< |
} else { |
172 |
< |
hresolu = dev->xsiz; |
173 |
< |
vresolu = hresolu*viewaspect(&ourview)/dev->pixaspect; |
174 |
< |
} |
179 |
> |
hresolu = dev->xsiz; |
180 |
> |
vresolu = dev->ysiz; |
181 |
> |
normaspect(viewaspect(&ourview), &dev->pixaspect, &hresolu, &vresolu); |
182 |
|
pframe.l = pframe.d = 0; |
183 |
|
pframe.r = hresolu; pframe.u = vresolu; |
184 |
|
pdepth = 0; |
357 |
|
if ((err = setview(vp)) != NULL) { |
358 |
|
sprintf(errmsg, "view not set - %s", err); |
359 |
|
error(COMMAND, errmsg); |
360 |
< |
} else if (bcmp(vp, &ourview, sizeof(VIEW))) { |
361 |
< |
copyview(&oldview, &ourview); |
362 |
< |
copyview(&ourview, vp); |
363 |
< |
newimage(); /* newimage() calls with vp=&ourview! */ |
360 |
> |
} else if (bcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) { |
361 |
> |
copystruct(&oldview, &ourview); |
362 |
> |
copystruct(&ourview, vp); |
363 |
> |
newimage(); |
364 |
|
} |
365 |
|
} |
366 |
|
|