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

Comparing ray/src/cv/mgflib/context.c (file contents):
Revision 1.23 by greg, Mon Aug 28 16:44:12 1995 UTC vs.
Revision 1.24 by greg, Wed Feb 12 11:38:52 1997 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1994 Regents of the University of California */
1 > /* Copyright (c) 1997 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 177 | Line 177 | register char  **av;
177                  if (!isflt(av[1]))
178                          return(MG_ETYPE);
179                  wsum = atof(av[1]);
180                if (wsum < 0.)
181                        return(MG_EILL);
180                  if ((lp = lu_find(&clr_tab, av[2])) == NULL)
181                          return(MG_EMEM);
182                  if (lp->data == NULL)
# Line 188 | Line 186 | register char  **av;
186                          if (!isflt(av[i]))
187                                  return(MG_ETYPE);
188                          w = atof(av[i]);
191                        if (w < 0.)
192                                return(MG_EILL);
189                          if ((lp = lu_find(&clr_tab, av[i+1])) == NULL)
190                                  return(MG_EMEM);
191                          if (lp->data == NULL)
# Line 198 | Line 194 | register char  **av;
194                                          w, (C_COLOR *)lp->data);
195                          wsum += w;
196                  }
197 +                if (wsum <= 0.)
198 +                        return(MG_EILL);
199                  c_ccolor->clock++;
200                  return(MG_OK);
201          }
# Line 667 | Line 665 | double w1, w2;
665          } else {                                        /* CIE xy mixing */
666                  c_ccvt(c1, C_CSXY);
667                  c_ccvt(c2, C_CSXY);
668 <                scale = 1. / (w1/c1->cy + w2/c2->cy);
668 >                scale = w1/c1->cy + w2/c2->cy;
669 >                if (scale == 0.)
670 >                        return;
671 >                scale = 1. / scale;
672                  cres->cx = (c1->cx*w1/c1->cy + c2->cx*w2/c2->cy) * scale;
673                  cres->cy = (w1 + w2) * scale;
674                  cres->flags = C_CDXY|C_CSXY;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines