--- ray/src/rt/rv3.c 1990/01/08 13:38:09 1.9 +++ ray/src/rt/rv3.c 1990/02/27 09:51:00 1.14 @@ -18,7 +18,11 @@ static char SCCSid[] = "$SunId$ LBL"; #include "random.h" +#ifndef WFLUSH +#define WFLUSH 30 /* flush after this many rays */ +#endif + getrect(s, r) /* get a box */ char *s; register RECT *r; @@ -130,6 +134,8 @@ paint(p, xmin, ymin, xmax, ymax) /* compute and paint register PNODE *p; int xmin, ymin, xmax, ymax; { + extern long nrays; + static long lastflush = 0; static RAY thisray; double h, v; register int i; @@ -157,6 +163,11 @@ int xmin, ymin, xmax, ymax; scalecolor(p->v, exposure); (*dev->paintr)(greyscale?greyof(p->v):p->v, xmin, ymin, xmax, ymax); + + if (dev->flush != NULL && nrays - lastflush >= WFLUSH) { + lastflush = nrays; + (*dev->flush)(); + } } @@ -165,13 +176,9 @@ newimage() /* start a new image */ /* free old image */ freepkids(&ptrunk); /* compute resolution */ - if (viewaspect(&ourview)*dev->xsiz > dev->pixaspect*dev->ysiz) { - vresolu = dev->ysiz; - hresolu = vresolu/viewaspect(&ourview)*dev->pixaspect; - } else { - hresolu = dev->xsiz; - vresolu = hresolu*viewaspect(&ourview)/dev->pixaspect; - } + hresolu = dev->xsiz; + vresolu = dev->ysiz; + normaspect(viewaspect(&ourview), &dev->pixaspect, &hresolu, &vresolu); pframe.l = pframe.d = 0; pframe.r = hresolu; pframe.u = vresolu; pdepth = 0; @@ -350,10 +357,10 @@ register VIEW *vp; if ((err = setview(vp)) != NULL) { sprintf(errmsg, "view not set - %s", err); error(COMMAND, errmsg); - } else if (bcmp(vp, &ourview, sizeof(VIEW))) { - copyview(&oldview, &ourview); - copyview(&ourview, vp); - newimage(); /* newimage() calls with vp=&ourview! */ + } else if (bcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) { + copystruct(&oldview, &ourview); + copystruct(&ourview, vp); + newimage(); } }