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

Comparing ray/src/px/pcompos.c (file contents):
Revision 2.30 by greg, Wed May 25 04:44:26 2005 UTC vs.
Revision 2.31 by greg, Tue Jun 6 19:13:00 2006 UTC

# Line 52 | Line 52 | struct {
52          int  xres, yres;                /* picture size */
53          int  xloc, yloc;                /* anchor point */
54          int  flags;                     /* HASMIN, HASMAX */
55 <        COLR  thmin, thmax;             /* thresholds */
55 >        double  thmin, thmax;           /* thresholds */
56   } input[MAXFILE];               /* our input files */
57  
58   int  nfile;                     /* number of files */
# Line 63 | Line 63 | int  wrongformat = 0;
63  
64   static gethfunc tabputs;
65   static void compos(void);
66 < static int cmpcolr(COLR  c1, COLR  c2);
66 > static int cmpcolr(COLR  c1, double lv2);
67   static FILE * lblopen(char  *s, int  *xp, int  *yp);
68  
69  
# Line 169 | Line 169 | dofiles:
169                                  checkthresh = 1;
170                                  if (argv[an][0] == '-') {
171                                          input[nfile].flags |= HASMIN;
172 <                                        setcolr(input[nfile].thmin,
173 <                                                        atof(argv[an+1]),
174 <                                                        atof(argv[an+1]),
175 <                                                        atof(argv[an+1]));
172 >                                        input[nfile].thmin = atof(argv[an+1]);
173                                  } else if (argv[an][0] == '+') {
174                                          input[nfile].flags |= HASMAX;
175 <                                        setcolr(input[nfile].thmax,
179 <                                                        atof(argv[an+1]),
180 <                                                        atof(argv[an+1]),
181 <                                                        atof(argv[an+1]));
175 >                                        input[nfile].thmax = atof(argv[an+1]);
176                                  } else
177                                          goto userr;
178                                  an++;
# Line 393 | Line 387 | memerr:
387  
388  
389   static int
390 < cmpcolr(                        /* compare two colr's (improvisation) */
390 > cmpcolr(                        /* compare COLR to luminance */
391          register COLR  c1,
392 <        register COLR  c2
392 >        double lv2
393   )
394   {
395 <        register int  i, j;
396 <
397 <        j = 4;                          /* check exponents first! */
398 <        while (j--)
399 <                if ( (i = c1[j] - c2[j]) )
400 <                        return(i);
395 >        double  lv1 = .0;
396 >        
397 >        if (c1[EXP])
398 >                lv1 = ldexp((double)normbright(c1), (int)c1[EXP]-(COLXS+8));
399 >        if (lv1 < lv2) return(-1);
400 >        if (lv1 > lv2) return(1);
401          return(0);
402   }
403  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines