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

Comparing ray/src/px/ra_bmp.c (file contents):
Revision 2.6 by greg, Fri Apr 30 17:56:06 2004 UTC vs.
Revision 2.8 by greg, Tue Jul 20 03:08:42 2004 UTC

# Line 162 | Line 162 | main(int argc, char *argv[])
162                  if (hdr == NULL)
163                          quiterr("cannot initialize BMP header");
164                                          /* set up output direction */
165 <                hdr->yIsDown = (rs.rt & YDECR) &&
166 <                                ((outfile == NULL) | (hdr->compr == BI_RLE8));
165 >                hdr->yIsDown = ((outfile == NULL) | (hdr->compr == BI_RLE8));
166                                          /* open BMP output */
167                  if (outfile != NULL)
168                          wtr = BMPopenOutputFile(outfile, hdr);
# Line 172 | Line 171 | main(int argc, char *argv[])
171                  if (wtr == NULL)
172                          quiterr("cannot allocate writer structure");
173                                          /* convert file */
174 <                rad2bmp(stdin, wtr, !hdr->yIsDown && rs.rt&YDECR, rgbp==NULL);
174 >                rad2bmp(stdin, wtr, !hdr->yIsDown, rgbp==NULL);
175                                          /* flush output */
176                  if (fflush((FILE *)wtr->c_data) < 0)
177                          quiterr("error writing BMP output");
# Line 293 | Line 292 | tmap2bmp(char *fnin, char *fnout, char *expec, RGBPRIM
292          int             tmflags;
293          BMPHeader       *hdr;
294          BMPWriter       *wtr;
296        RESOLU          rs;
295          FILE            *fp;
296          int             xr, yr;
297          BYTE            *pa;
# Line 319 | Line 317 | tmap2bmp(char *fnin, char *fnout, char *expec, RGBPRIM
317                  fprintf(stderr, "%s: cannot open\n", fnin);
318                  exit(1);
319          }
322                                        /* get picture orientation */
323        if (fnin != NULL) {
324                if (getheader(fp, NULL, NULL) < 0 || !fgetsresolu(&rs, fp))
325                        quiterr("bad Radiance picture format");
326                rewind(fp);
327        } else                          /* assume stdin has normal orient */
328                rs.rt = PIXSTANDARD;
320                                          /* tone-map picture */
321          if (tmMapPicture(&pa, &xr, &yr, tmflags, monpri, gamval,
322                          0., 0., fnin, fp) != TM_E_OK)
# Line 349 | Line 340 | tmap2bmp(char *fnin, char *fnout, char *expec, RGBPRIM
340                                          /* write to BMP file */
341          while (wtr->yscan < yr) {
342                  BYTE    *scn = pa + xr*((tmflags & TM_F_BW) ? 1 : 3)*
343 <                                        ((rs.rt & YDECR) ?
353 <                                                (yr-1 - wtr->yscan) :
354 <                                                wtr->yscan);
343 >                                                (yr-1 - wtr->yscan);
344                  if (tmflags & TM_F_BW)
345                          memcpy((void *)wtr->scanline, (void *)scn, xr);
346                  else
# Line 367 | Line 356 | tmap2bmp(char *fnin, char *fnout, char *expec, RGBPRIM
356          if (fflush((FILE *)wtr->c_data) < 0)
357                  quiterr("error writing BMP output");
358                                          /* clean up */
359 +        if (fnin != NULL)
360 +                fclose(fp);
361          free((void *)pa);
362          BMPcloseOutput(wtr);
363   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines