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

Comparing ray/src/common/color.c (file contents):
Revision 2.10 by greg, Tue Feb 25 02:47:21 2003 UTC vs.
Revision 2.13 by schorsch, Sun Jul 27 22:12:01 2003 UTC

# Line 31 | Line 31 | unsigned int  len;
31  
32          if (len > tempbuflen) {
33                  if (tempbuflen > 0)
34 <                        tempbuf = (char *)realloc(tempbuf, len);
34 >                        tempbuf = (char *)realloc((void *)tempbuf, len);
35                  else
36                          tempbuf = (char *)malloc(len);
37                  tempbuflen = tempbuf==NULL ? 0 : len;
# Line 49 | Line 49 | register FILE  *fp;
49          register int  i, j, beg, cnt = 1;
50          int  c2;
51          
52 <        if (len < MINELEN | len > MAXELEN)      /* OOBs, write out flat */
52 >        if ((len < MINELEN) | (len > MAXELEN))  /* OOBs, write out flat */
53                  return(fwrite((char *)scanline,sizeof(COLR),len,fp) - len);
54                                          /* put magic header */
55          putc(2, fp);
# Line 139 | Line 139 | register FILE  *fp;
139          register int  i, j;
140          int  code, val;
141                                          /* determine scanline type */
142 <        if (len < MINELEN | len > MAXELEN)
142 >        if ((len < MINELEN) | (len > MAXELEN))
143                  return(oldreadcolrs(scanline, len, fp));
144          if ((i = getc(fp)) == EOF)
145                  return(-1);
# Line 253 | Line 253 | double  r, g, b;
253  
254          d = frexp(d, &e) * 255.9999 / d;
255  
256 <        clr[RED] = r * d;
257 <        clr[GRN] = g * d;
258 <        clr[BLU] = b * d;
256 >        if (r > 0.0)
257 >                clr[RED] = r * d;
258 >        else
259 >                clr[RED] = 0;
260 >        if (g > 0.0)
261 >                clr[GRN] = g * d;
262 >        else
263 >                clr[GRN] = 0;
264 >        if (b > 0.0)
265 >                clr[BLU] = b * d;
266 >        else
267 >                clr[BLU] = 0;
268 >
269          clr[EXP] = e + COLXS;
270   }
271  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines