ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rc2.c
(Generate patch)

Comparing ray/src/rt/rc2.c (file contents):
Revision 2.7 by greg, Thu Nov 15 19:41:03 2012 UTC vs.
Revision 2.12 by greg, Wed Jul 9 21:09:28 2014 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8  
9   #include "rcontrib.h"
10   #include "resolu.h"
11 + #include <ctype.h>
12  
13   /* Close output stream and free record */
14   static void
# Line 111 | Line 112 | printheader(FILE *fout, const char *info)
112          printargs(gargc-1, gargv, fout);        /* add our command */
113          fprintf(fout, "SOFTWARE= %s\n", VersionID);
114          fputnow(fout);
115 +        fputs("NCOMP=3\n", fout);               /* always RGB */
116          if (info != NULL)                       /* add extra info if given */
117                  fputs(info, fout);
118          fputformat(formstr(outfmt), fout);
# Line 131 | Line 133 | printresolu(FILE *fout, int xr, int yr)
133   STREAMOUT *
134   getostream(const char *ospec, const char *mname, int bn, int noopen)
135   {
134        /* static const DCOLOR  nocontrib = BLKCOLOR; */
136          static STREAMOUT        stdos;
137 +        char                    info[1024];
138          int                     ofl;
139          char                    oname[1024];
140          LUENT                   *lep;
141          STREAMOUT               *sop;
142 +        char                    *cp;
143          
144          if (ospec == NULL) {                    /* use stdout? */
145                  if (!noopen & !using_stdout) {
146                          if (outfmt != 'a')
147                                  SET_FILE_BINARY(stdout);
148 <                        if (header)
149 <                                printheader(stdout, NULL);
148 >                        if (header) {
149 >                                cp = info;
150 >                                if (yres > 0) {
151 >                                        sprintf(cp, "NROWS=%d\n", yres *
152 >                                                        (xres + !xres) );
153 >                                        while (*cp) ++cp;
154 >                                }
155 >                                sprintf(cp, "NCOLS=%d\n", stdos.reclen);
156 >                                printheader(stdout, info);
157 >                        }
158                          printresolu(stdout, xres, yres);
159                          if (waitflush > 0)
160                                  fflush(stdout);
# Line 182 | Line 193 | getostream(const char *ospec, const char *mname, int b
193                  }
194          }
195          if (!noopen && sop->ofp == NULL) {      /* open output stream */
185                long            i;
196                  if (oname[0] == '!')            /* output to command */
197                          sop->ofp = popen(oname+1, "w");
198                  else                            /* else open file */
# Line 194 | Line 204 | getostream(const char *ospec, const char *mname, int b
204   #ifdef getc_unlocked
205                  flockfile(sop->ofp);            /* avoid lock/unlock overhead */
206   #endif
207 +                if (accumulate > 0) {           /* global resolution */
208 +                        sop->xr = xres; sop->yr = yres;
209 +                }
210                  if (header) {
211 <                        char    info[512];
199 <                        char    *cp = info;
211 >                        cp = info;
212                          if (ofl & OF_MODIFIER || sop->reclen == 1) {
213                                  sprintf(cp, "MODIFIER=%s\n", mname);
214                                  while (*cp) ++cp;
# Line 205 | Line 217 | getostream(const char *ospec, const char *mname, int b
217                                  sprintf(cp, "BIN=%d\n", bn);
218                                  while (*cp) ++cp;
219                          }
220 <                        *cp = '\0';
220 >                        if (sop->yr > 0) {
221 >                                sprintf(cp, "NROWS=%d\n", sop->yr *
222 >                                                (sop->xr + !sop->xr) );
223 >                                while (*cp) ++cp;
224 >                        }
225 >                        sprintf(cp, "NCOLS=%d\nNCOMP=3\n", sop->reclen);
226                          printheader(sop->ofp, info);
227                  }
211                if (accumulate > 0) {           /* global resolution */
212                        sop->xr = xres; sop->yr = yres;
213                }
228                  printresolu(sop->ofp, sop->xr, sop->yr);
215 #if 0
216                                                /* play catch-up */
217                for (i = accumulate > 0 ? lastdone/accumulate : 0; i--; ) {
218                        int     j = sop->reclen;
219                        if (j <= 0) j = 1;
220                        while (j--)
221                                put_contrib(nocontrib, sop->ofp);
222                        if (outfmt == 'a')
223                                putc('\n', sop->ofp);
224                }
225 #endif
229                  if (waitflush > 0)
230                          fflush(sop->ofp);
231          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines