14 |
|
#include "color.h" |
15 |
|
#include "resolu.h" |
16 |
|
#include "lookup.h" |
17 |
+ |
#include "random.h" |
18 |
|
#include "calcomp.h" |
19 |
|
|
20 |
|
#ifndef MAXMODLIST |
546 |
|
raysleft = 0; |
547 |
|
if ((account = accumulate) > 0) |
548 |
|
raysleft *= accumulate; |
549 |
< |
waitflush = xres; |
549 |
> |
waitflush = (yres > 0) & (xres > 1) ? 0 : xres; |
550 |
|
if (!recover) |
551 |
|
return; |
552 |
|
/* recover previous values */ |
737 |
|
{ |
738 |
|
if ((xr > 0) & (yr > 0)) /* resolution string */ |
739 |
|
fprtresolu(xr, yr, fout); |
739 |
– |
if (xres > 0) /* global flush flag */ |
740 |
– |
fflush(fout); |
740 |
|
} |
741 |
|
|
742 |
|
/* Get output stream pointer (open and write header if new and noopen==0) */ |
757 |
|
if (header) |
758 |
|
printheader(stdout, NULL); |
759 |
|
printresolu(stdout, xres, yres); |
760 |
+ |
if (waitflush > 0) |
761 |
+ |
fflush(stdout); |
762 |
|
stdos.xr = xres; stdos.yr = yres; |
763 |
|
using_stdout = 1; |
764 |
|
} |
827 |
|
if (outfmt == 'a') |
828 |
|
putc('\n', sop->ofp); |
829 |
|
} |
830 |
< |
if (xres > 0) |
830 |
> |
if (waitflush > 0) |
831 |
|
fflush(sop->ofp); |
832 |
|
} |
833 |
|
sop->reclen += noopen; /* add to length if noopen */ |
957 |
|
default: |
958 |
|
error(INTERNAL, "botched output format"); |
959 |
|
} |
960 |
+ |
if (waitflush < 0 && frandom() < 0.001) |
961 |
+ |
fflush(fout); /* staggers writes */ |
962 |
|
} |
963 |
|
|
964 |
|
/* output ray tallies and clear for next accumulation */ |
996 |
|
if (using_stdout & (outfmt == 'a')) |
997 |
|
putc('\n', stdout); |
998 |
|
if (!waitflush) { |
999 |
< |
waitflush = xres; |
999 |
> |
waitflush = (yres > 0) & (xres > 1) ? 0 : xres; |
1000 |
|
if (using_stdout) |
1001 |
|
fflush(stdout); |
1002 |
|
} |