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

Comparing ray/src/px/pextrem.c (file contents):
Revision 2.14 by greg, Fri Jul 19 17:37:56 2019 UTC vs.
Revision 2.15 by greg, Fri Feb 4 20:11:49 2022 UTC

# Line 15 | Line 15 | static const char      RCSid[] = "$Id$";
15  
16   int  orig = 0;
17  
18 int  wrongformat = 0;
19
18   COLOR  expos = WHTCOLOR;
19  
20 + char    fmt[MAXFMTLEN];
21 +
22   static gethfunc headline;
23  
24  
# Line 28 | Line 28 | headline(                      /* check header line */
28          void    *p
29   )
30   {
31        char    fmt[MAXFMTLEN];
31          double  d;
32          COLOR   ctmp;
33  
34 <        if (isformat(s)) {                      /* format */
35 <                formatval(fmt, s);
37 <                wrongformat = !globmatch(PICFMT, fmt);
38 <        }
34 >        if (formatval(fmt, s))                  /* format */
35 >                return(0);
36          if (!orig)
37                  return(0);
38          if (isexpos(s)) {                       /* exposure */
# Line 66 | Line 63 | main(
63          SET_FILE_BINARY(stdin);
64          for (i = 1; i < argc; i++)      /* get options */
65                  if (!strcmp(argv[i], "-o"))
66 <                        orig++;
66 >                        orig = 1;
67 >                else if (!strcmp(argv[i], "-O"))
68 >                        orig = -1;
69                  else
70                          break;
71  
# Line 76 | Line 75 | main(
75                  exit(1);
76          }
77                                          /* get our header */
78 <        if (getheader(stdin, headline, NULL) < 0 || wrongformat ||
78 >        if (getheader(stdin, headline, NULL) < 0 || !globmatch(PICFMT, fmt) ||
79                          fgetresolu(&xres, &yres, stdin) < 0) {
80                  fprintf(stderr, "%s: bad picture format\n", argv[0]);
81                  exit(1);
82          }
83 +        if (orig < 0 && !strcmp(CIEFMT, fmt))
84 +                scalecolor(expos, 1./WHTEFFICACY);
85          if ((scan = (COLR *)malloc(xres*sizeof(COLR))) == NULL) {
86                  fprintf(stderr, "%s: out of memory\n", argv[0]);
87                  exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines