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.14 by greg, Tue Dec 9 15:51:42 2003 UTC

# Line 17 | Line 17 | static const char      RCSid[] = "$Id$";
17  
18   #include  "color.h"
19  
20 + #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
21 + #define getc    getc_unlocked
22 + #define putc    putc_unlocked
23 + #endif
24 +
25   #define  MINELEN        8       /* minimum scanline length for encoding */
26   #define  MAXELEN        0x7fff  /* maximum scanline length for encoding */
27   #define  MINRUN         4       /* minimum run length */
# Line 31 | Line 36 | unsigned int  len;
36  
37          if (len > tempbuflen) {
38                  if (tempbuflen > 0)
39 <                        tempbuf = (char *)realloc(tempbuf, len);
39 >                        tempbuf = (char *)realloc((void *)tempbuf, len);
40                  else
41                          tempbuf = (char *)malloc(len);
42                  tempbuflen = tempbuf==NULL ? 0 : len;
# Line 49 | Line 54 | register FILE  *fp;
54          register int  i, j, beg, cnt = 1;
55          int  c2;
56          
57 <        if (len < MINELEN | len > MAXELEN)      /* OOBs, write out flat */
57 >        if ((len < MINELEN) | (len > MAXELEN))  /* OOBs, write out flat */
58                  return(fwrite((char *)scanline,sizeof(COLR),len,fp) - len);
59                                          /* put magic header */
60          putc(2, fp);
# Line 139 | Line 144 | register FILE  *fp;
144          register int  i, j;
145          int  code, val;
146                                          /* determine scanline type */
147 <        if (len < MINELEN | len > MAXELEN)
147 >        if ((len < MINELEN) | (len > MAXELEN))
148                  return(oldreadcolrs(scanline, len, fp));
149          if ((i = getc(fp)) == EOF)
150                  return(-1);
# Line 253 | Line 258 | double  r, g, b;
258  
259          d = frexp(d, &e) * 255.9999 / d;
260  
261 <        clr[RED] = r * d;
262 <        clr[GRN] = g * d;
263 <        clr[BLU] = b * d;
261 >        if (r > 0.0)
262 >                clr[RED] = r * d;
263 >        else
264 >                clr[RED] = 0;
265 >        if (g > 0.0)
266 >                clr[GRN] = g * d;
267 >        else
268 >                clr[GRN] = 0;
269 >        if (b > 0.0)
270 >                clr[BLU] = b * d;
271 >        else
272 >                clr[BLU] = 0;
273 >
274          clr[EXP] = e + COLXS;
275   }
276  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines