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

Comparing ray/src/rt/colortab.c (file contents):
Revision 2.7 by greg, Tue May 13 17:58:33 2003 UTC vs.
Revision 2.10 by greg, Fri May 20 02:06:39 2011 UTC

# Line 17 | Line 17 | static const char      RCSid[] = "$Id$";
17  
18   #include "copyright.h"
19  
20 < #include "standard.h"
20 > #include <string.h>
21  
22 + #include "standard.h"
23   #include "color.h"
24 + #include "driver.h"
25 +
26                                  /* histogram resolution */
27   #define NRED            24
28   #define NGRN            32
# Line 45 | Line 48 | static const char      RCSid[] = "$Id$";
48   static struct tabent {
49          long    sum[3];         /* sum of colors using this entry */
50          int     n;              /* number of colors */
51 <        BYTE    ent[3];         /* current table value */
51 >        uby8    ent[3];         /* current table value */
52   }       *clrtab = NULL;
53                                  /* color cube partition */
54   static CNODE    *ctree = NULL;
55                                  /* our color correction map */
56 < static BYTE     clrmap[3][256];
56 > static uby8     clrmap[3][256];
57                                  /* histogram of colors used */
58   static unsigned short   histo[NRED][NGRN][NBLU];
59                                  /* initial color cube boundary */
# Line 84 | Line 87 | int    ncolors;
87                                  /* partition color space */
88          cut(ctree, 0, CLRCUBE, 0, ncolors);
89                                  /* clear histogram */
90 <        bzero((void *)histo, sizeof(histo));
90 >        memset((void *)histo, '\0', sizeof(histo));
91                                  /* return number of colors used */
92          return(ncolors);
93   }
94  
95  
96 < int
97 < get_pixel(col, set_pixel)       /* get pixel for color */
98 < COLOR   col;
99 < void    (*set_pixel)();
96 > extern int
97 > get_pixel(      /* get pixel for color */
98 >        COLOR   col,
99 >        dr_newcolrf_t *newcolr
100 > )
101   {
102          int     r, g, b;
103          int     cv[3];
# Line 138 | Line 142 | void   (*set_pixel)();
142                                  h, r, g, b, clrtab[h].n);
143                  eputs(errmsg);
144   #endif
145 <                (*set_pixel)(h, r, g, b);
145 >                (*newcolr)(h, r, g, b);
146          }
147          return(h);                              /* return pixel value */
148   }
# Line 159 | Line 163 | double gam;
163  
164   void
165   set_cmap(rmap, gmap, bmap)      /* set custom color correction map */
166 < BYTE    *rmap, *gmap, *bmap;
166 > uby8    *rmap, *gmap, *bmap;
167   {
168 <        bcopy((void *)rmap, (void *)clrmap[RED], 256);
169 <        bcopy((void *)gmap, (void *)clrmap[GRN], 256);
170 <        bcopy((void *)bmap, (void *)clrmap[BLU], 256);
168 >        memcpy((void *)clrmap[RED], (void *)rmap, 256);
169 >        memcpy((void *)clrmap[GRN], (void *)gmap, 256);
170 >        memcpy((void *)clrmap[BLU], (void *)bmap, 256);
171   }
172  
173  
174   void
175   map_color(rgb, col)             /* map a color to a byte triplet */
176 < BYTE    rgb[3];
176 > uby8    rgb[3];
177   COLOR   col;
178   {
179          rgb[RED] = map_col(col,RED);
# Line 193 | Line 197 | int    c0, c1;
197          }
198                                          /* split box */
199          *tree = split(box);
200 <        bcopy((void *)box, (void *)kb, sizeof(kb));
200 >        memcpy((void *)kb, (void *)box, sizeof(kb));
201                                                  /* do left (lesser) branch */
202          kb[prim(*tree)][1] = part(*tree);
203          cut(tree+(1<<level), level+1, kb, c0, (c0+c1)>>1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines