comparison src/gifalloc.c @ 203:850242ba4a81 r20-3b28

Import from CVS: tag r20-3b28
author cvs
date Mon, 13 Aug 2007 10:02:21 +0200
parents 43dd3413c7c7
children
comparison
equal deleted inserted replaced
202:61eefc8fc970 203:850242ba4a81
45 45
46 #ifndef MAX 46 #ifndef MAX
47 #define MAX(x, y) (((x) > (y)) ? (x) : (y)) 47 #define MAX(x, y) (((x) > (y)) ? (x) : (y))
48 #endif 48 #endif
49 49
50 #ifndef REGISTER /* Rigidly enforced in 20.3 */
51 #define REGISTER
52 #endif
53
50 /****************************************************************************** 54 /******************************************************************************
51 * Miscellaneous utility functions * 55 * Miscellaneous utility functions *
52 ******************************************************************************/ 56 ******************************************************************************/
53 57
54 int BitSize(int n) 58 int BitSize(int n)
55 /* return smallest bitfield size n will fit in */ 59 /* return smallest bitfield size n will fit in */
56 { 60 {
57 register i; 61 REGISTER int i;
58 62
59 for (i = 1; i <= 8; i++) 63 for (i = 1; i <= 8; i++)
60 if ((1 << i) >= n) 64 if ((1 << i) >= n)
61 break; 65 break;
62 return(i); 66 return(i);
194 NewBitSize = BitSize(CrntSlot); 198 NewBitSize = BitSize(CrntSlot);
195 RoundUpTo = (1 << NewBitSize); 199 RoundUpTo = (1 << NewBitSize);
196 200
197 if (RoundUpTo != ColorUnion->ColorCount) 201 if (RoundUpTo != ColorUnion->ColorCount)
198 { 202 {
199 register GifColorType *Map = ColorUnion->Colors; 203 REGISTER GifColorType *Map = ColorUnion->Colors;
200 204
201 /* 205 /*
202 * Zero out slots up to next power of 2. 206 * Zero out slots up to next power of 2.
203 * We know these slots exist because of the way ColorUnion's 207 * We know these slots exist because of the way ColorUnion's
204 * start dimension was computed. 208 * start dimension was computed.
221 void ApplyTranslation(SavedImage *Image, GifPixelType Translation[]) 225 void ApplyTranslation(SavedImage *Image, GifPixelType Translation[])
222 /* 226 /*
223 * Apply a given color translation to the raster bits of an image 227 * Apply a given color translation to the raster bits of an image
224 */ 228 */
225 { 229 {
226 register int i; 230 REGISTER int i;
227 register int RasterSize = Image->ImageDesc.Height * Image->ImageDesc.Width; 231 REGISTER int RasterSize = Image->ImageDesc.Height * Image->ImageDesc.Width;
228 232
229 for (i = 0; i < RasterSize; i++) 233 for (i = 0; i < RasterSize; i++)
230 Image->RasterBits[i] = Translation[Image->RasterBits[i]]; 234 Image->RasterBits[i] = Translation[Image->RasterBits[i]];
231 } 235 }
232 236