Mercurial > hg > xemacs-beta
comparison src/objects-x.c @ 269:b2472a1930f2 r20-5b33
Import from CVS: tag r20-5b33
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:27:19 +0200 |
parents | 262b8bb4a523 |
children | c5d627a313b1 |
comparison
equal
deleted
inserted
replaced
268:6ced69ccd85f | 269:b2472a1930f2 |
---|---|
112 color_def->blue = color_def->blue >> (16 - bbits); | 112 color_def->blue = color_def->blue >> (16 - bbits); |
113 if (XAllocColor (display, colormap, color_def) != 0) | 113 if (XAllocColor (display, colormap, color_def) != 0) |
114 status = 1; | 114 status = 1; |
115 else | 115 else |
116 { | 116 { |
117 int rd, gr, bl; | |
117 /* ### JH: I'm punting here, knowing that doing this will at | 118 /* ### JH: I'm punting here, knowing that doing this will at |
118 least draw the color correctly. However, unless we convert | 119 least draw the color correctly. However, unless we convert |
119 all of the functions that allocate colors (graphics | 120 all of the functions that allocate colors (graphics |
120 libraries, etc) to use this function doing this is very | 121 libraries, etc) to use this function doing this is very |
121 likely to cause problems later... */ | 122 likely to cause problems later... */ |
122 color_def->pixel = (color_def->red << rshift) | (color_def->green << gshift) | | 123 |
123 (color_def->blue << bshift); | 124 if (rbits > 8) |
125 rd = color_def->red << (rbits - 8); | |
126 else | |
127 rd = color_def->red >> (8 - rbits); | |
128 if (gbits > 8) | |
129 gr = color_def->green << (gbits - 8); | |
130 else | |
131 gr = color_def->green >> (8 - gbits); | |
132 if (bbits > 8) | |
133 bl = color_def->blue << (bbits - 8); | |
134 else | |
135 bl = color_def->blue >> (8 - bbits); | |
136 color_def->pixel = (rd << rshift) | (gr << gshift) | (bl << bshift); | |
124 status = 3; | 137 status = 3; |
125 } | 138 } |
126 } | 139 } |
127 } | 140 } |
128 else | 141 else |
178 } | 191 } |
179 } | 192 } |
180 color_def->red = cells[nearest].red; | 193 color_def->red = cells[nearest].red; |
181 color_def->green = cells[nearest].green; | 194 color_def->green = cells[nearest].green; |
182 color_def->blue = cells[nearest].blue; | 195 color_def->blue = cells[nearest].blue; |
183 if (XAllocColor (display, colormap, color_def) != 0) | 196 if (XAllocColor (display, colormap, color_def) != 0) { |
184 status = 2; | 197 status = 2; |
185 else | 198 } else { |
186 status = 0; /* JH: how does this happen??? DOES this happen??? */ | 199 status = 0; /* JH: how does this happen??? DOES this happen??? */ |
200 fprintf(stderr,"allocate_nearest_color returned 0!!!\n"); | |
201 } | |
187 } | 202 } |
188 } | 203 } |
189 return status; | 204 return status; |
190 } | 205 } |
191 | 206 |