/* Make some variables global, so we could access them faster: */
static int
- BackGround = 0,
- ColorMapSize = 0,
- InterlacedOffset[] = { 0, 4, 2, 1 }, /* The way Interlaced image should. */
- InterlacedJumps[] = { 8, 8, 4, 2 }; /* be read - offsets and jumps... */
+ InterlacedOffset[] = { 0, 4, 2, 1 }, /* The way Interlaced image should. */
+ InterlacedJumps[] = { 8, 8, 4, 2 }; /* be read - offsets and jumps... */
-static ColorMapObject *ColorMap;
+/* static ColorMapObject *ColorMap; */
static
void
-i_colortable_copy(int **colour_table, int *colours, ColorMapObject *colormap) {
+i_colortable_copy(int **colour_table, int *colours, ColorMapObject *colourmap) {
GifColorType *mapentry;
int q;
- int colormapsize = colormap->ColorCount;
+ int colourmapsize = colourmap->ColorCount;
- if(colours) *colours = colormapsize;
+ if(colours) *colours = colourmapsize;
if(!colour_table) return;
- *colour_table = mymalloc(sizeof(int *) * colormapsize * 3);
- memset(*colour_table, 0, sizeof(int *) * colormapsize * 3);
+ *colour_table = mymalloc(sizeof(int *) * colourmapsize * 3);
+ memset(*colour_table, 0, sizeof(int *) * colourmapsize * 3);
- for(q=0; q<ColorMapSize; q++) {
- mapentry = &colormap->Colors[q];
+ for(q=0; q<colourmapsize; q++) {
+ mapentry = &colourmap->Colors[q];
(*colour_table)[q*3 + 0] = mapentry->Red;
(*colour_table)[q*3 + 1] = mapentry->Green;
(*colour_table)[q*3 + 2] = mapentry->Blue;
i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) {
i_img *im;
int i, j, Size, Row, Col, Width, Height, ExtCode, Count, x;
- int cmapcnt = 0, ImageNum = 0;
-
+ int cmapcnt = 0, ImageNum = 0, BackGround = 0, ColorMapSize = 0;
+ ColorMapObject *ColorMap;
GifRecordType RecordType;
GifByteType *Extension;
col.rgb.r = ColorMapEntry->Red;
col.rgb.g = ColorMapEntry->Green;
col.rgb.b = ColorMapEntry->Blue;
- i_ppix(im,x,Row,&col);
+ i_ppix(im, x, Row, &col);
}
Row++;
}
The giflib quantizer ignores the palette.
*/
i_palidx *quant_translate(i_quantize *quant, i_img *img) {
- i_palidx *result = mymalloc(img->xsize * img->ysize);
+ i_palidx *result;
+ mm_log((1, "quant_translate(quant %p, img %p)\n", quant, img));
+
+ result = mymalloc(img->xsize * img->ysize);
+
switch (quant->translate) {
#ifdef HAVE_LIBGIF
case pt_giflib:
i_color col;
- /*mm_log((1,"i_writegif(0x%x, fd %d, colors %dbpp)\n",im,fd,colors));*/
+ mm_log((1,"i_writegif(quant %p, img %p, out %p)\n", quant, img, out));
/*if (!(im->channels==1 || im->channels==3)) { fprintf(stderr,"Unable to write gif, improper colorspace.\n"); exit(3); }*/