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.20 by greg, Mon Jan 4 19:40:14 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] <= -.5) | (pr[i][CIEY] <= -.5))
248                          return(0);
249 <                if ((pr[i][CIEX] >= 1.-CEPS) | (pr[i][CIEY] >= 1.-CEPS))
249 >                if ((pr[i][CIEX] >= 1.5) | (pr[i][CIEY] >= 1.5))
250                          return(0);
251 +                if (pr[i][CIEX] + pr[i][CIEY] >= 1.5)
252 +                        return(0);
253          }
254 +        for (i = 0; i < 4; i++)
255 +                for (j = i+1; j < 4; j++)
256 +                        if (CEQ(pr[i][CIEX],pr[j][CIEX]) &&
257 +                                        CEQ(pr[i][CIEY],pr[j][CIEY]))
258 +                                return(0);
259          return(1);
260   }
261  
# Line 264 | Line 271 | register RGBPRIMS  pr
271  
272          if (pr == stdprims) {   /* can use xyz2rgbmat */
273                  cpcolormat(mat, xyz2rgbmat);
274 <                return;
274 >                return(1);
275          }
276          if (CEQ(pr[WHT][CIEX],0.) | CEQ(pr[WHT][CIEY],0.))
277                  return(0);
# Line 324 | Line 331 | register RGBPRIMS  pr
331  
332          if (pr == stdprims) {   /* can use rgb2xyzmat */
333                  cpcolormat(mat, rgb2xyzmat);
334 <                return;
334 >                return(1);
335          }
336          if (CEQ(pr[WHT][CIEX],0.) | CEQ(pr[WHT][CIEY],0.))
337                  return(0);
# Line 371 | Line 378 | RGBPRIMS  pr2
378                  mat[0][0] = mat[1][1] = mat[2][2] = 1.0;
379                  mat[0][1] = mat[0][2] = mat[1][0] =
380                  mat[1][2] = mat[2][0] = mat[2][1] = 0.0;
381 <                return;
381 >                return(1);
382          }
383          if (!comprgb2xyzmat(pr1toxyz, pr1))
384                  return(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines