25 |
|
#define sscanvec(s,v) (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3) |
26 |
|
#endif |
27 |
|
|
28 |
< |
static int niflush; /* flushes since newimage() */ |
28 |
> |
static unsigned long niflush; /* flushes since newimage() */ |
29 |
|
|
30 |
|
int |
31 |
|
getrect( /* get a box */ |
155 |
|
extern int ray_pnprocs; |
156 |
|
static unsigned long lastflush = 0; |
157 |
|
static RAY thisray; |
158 |
+ |
int flushintvl; |
159 |
|
double h, v; |
160 |
|
|
161 |
|
if (p->xmax - p->xmin <= 0 || p->ymax - p->ymin <= 0) { /* empty */ |
189 |
|
(*dev->paintr)(greyscale?greyof(p->v):p->v, |
190 |
|
p->xmin, p->ymin, p->xmax, p->ymax); |
191 |
|
|
192 |
< |
if (dev->flush != NULL && raynum - lastflush >= ray_pnprocs * |
193 |
< |
(ambounce > 0 && niflush < WFLUSH ? niflush : WFLUSH)) { |
192 |
> |
if (ambounce <= 0) /* shall we check for input? */ |
193 |
> |
flushintvl = ray_pnprocs*WFLUSH; |
194 |
> |
else if (niflush < WFLUSH) |
195 |
> |
flushintvl = ray_pnprocs*niflush/(ambounce+1); |
196 |
> |
else |
197 |
> |
flushintvl = ray_pnprocs*WFLUSH/(ambounce+1); |
198 |
> |
|
199 |
> |
if (dev->flush != NULL && raynum - lastflush >= flushintvl) { |
200 |
|
lastflush = raynum; |
201 |
|
(*dev->flush)(); |
202 |
|
niflush++; |
206 |
|
|
207 |
|
|
208 |
|
int |
209 |
< |
waitrays(void) /* finish up pending rays */ |
209 |
> |
waitrays(void) /* finish up pending rays */ |
210 |
|
{ |
211 |
|
int nwaited = 0; |
212 |
|
int rval; |