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

Comparing ray/src/common/spec_rgb.c (file contents):
Revision 2.15 by greg, Tue Sep 5 21:54:32 2006 UTC vs.
Revision 2.21 by greg, Mon Apr 12 21:24:07 2010 UTC

# Line 241 | Line 241 | colorprimsOK(                  /* are color primaries reasonable? */
241   RGBPRIMS  pr
242   )
243   {
244 <        int     i;
244 >        int     i, j;
245          
246          for (i = 0; i < 4; i++) {
247 <                if ((pr[i][CIEX] <= CEPS) | (pr[i][CIEY] <= CEPS))
247 >                if ((pr[i][CIEX] <= -1.) | (pr[i][CIEY] <= -1.))
248                          return(0);
249 <                if ((pr[i][CIEX] >= 1.-CEPS) | (pr[i][CIEY] >= 1.-CEPS))
249 >                if ((pr[i][CIEX] >= 2.) | (pr[i][CIEY] >= 2.))
250                          return(0);
251 +                if (pr[i][CIEX] + pr[i][CIEY] <= -1.)
252 +                        return(0);
253 +                if (pr[i][CIEX] + pr[i][CIEY] >= 2.)
254 +                        return(0);
255          }
256 +        for (i = 0; i < 4; i++)
257 +                for (j = i+1; j < 4; j++)
258 +                        if (CEQ(pr[i][CIEX],pr[j][CIEX]) &&
259 +                                        CEQ(pr[i][CIEY],pr[j][CIEY]))
260 +                                return(0);
261          return(1);
262   }
263  
# Line 264 | Line 273 | register RGBPRIMS  pr
273  
274          if (pr == stdprims) {   /* can use xyz2rgbmat */
275                  cpcolormat(mat, xyz2rgbmat);
276 <                return;
276 >                return(1);
277          }
278          if (CEQ(pr[WHT][CIEX],0.) | CEQ(pr[WHT][CIEY],0.))
279                  return(0);
# Line 324 | Line 333 | register RGBPRIMS  pr
333  
334          if (pr == stdprims) {   /* can use rgb2xyzmat */
335                  cpcolormat(mat, rgb2xyzmat);
336 <                return;
336 >                return(1);
337          }
338          if (CEQ(pr[WHT][CIEX],0.) | CEQ(pr[WHT][CIEY],0.))
339                  return(0);
# Line 371 | Line 380 | RGBPRIMS  pr2
380                  mat[0][0] = mat[1][1] = mat[2][2] = 1.0;
381                  mat[0][1] = mat[0][2] = mat[1][0] =
382                  mat[1][2] = mat[2][0] = mat[2][1] = 0.0;
383 <                return;
383 >                return(1);
384          }
385          if (!comprgb2xyzmat(pr1toxyz, pr1))
386                  return(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines