--- ray/src/px/pcomb.c 1992/08/10 12:10:26 2.3 +++ ray/src/px/pcomb.c 1992/08/28 21:41:49 2.5 @@ -334,6 +334,7 @@ combine() /* combine pictures */ advance() /* read in data for next scanline */ { + extern double fabs(); int ytarget; register COLOR *st; register int i, j; @@ -346,13 +347,16 @@ advance() /* read in data for next scanline */ input[i].scan[0] = st; if (yscan <= MIDSCN) /* hit bottom? */ continue; - if (freadscan(st, xmax, input[i].fp) < 0) { /* read */ + if (freadscan(st, xmax, input[i].fp) < 0) { /* read */ eputs(input[i].name); eputs(": read error\n"); quit(1); } - for (j = 0; j < xmax; j++) /* adjust color */ - multcolor(st[j], input[i].coef); + if (fabs(colval(input[i].coef,RED)-1.0) > 1e-3 || + fabs(colval(input[i].coef,GRN)-1.0) > 1e-3 || + fabs(colval(input[i].coef,BLU)-1.0) > 1e-3) + for (j = 0; j < xmax; j++) /* adjust color */ + multcolor(st[j], input[i].coef); } } @@ -449,14 +453,29 @@ char *msg; } +#ifdef NIX + quit(code) -int code; +int code; { - int status; + exit(code); +} - if (code == 0) /* reap any children */ - while (wait(&status) != -1) - if (code == 0) - code = status>>8 & 0xff; +#else + +quit(code) /* exit gracefully */ +int code; +{ + int status; + register int i; + /* close input files */ + for (i = 0; i < nfiles; i++) + fclose(input[i].fp); + /* reap children */ + while (wait(&status) != -1) + if (code == 0) + code = status>>8 & 0xff; exit(code); } + +#endif