summaryrefslogtreecommitdiff
path: root/src/gd_gif_in.c
diff options
context:
space:
mode:
authorpierrejoye <none@none>2013-04-03 14:23:11 +0200
committerpierrejoye <none@none>2013-04-03 14:23:11 +0200
commite20413bf6b872a8c23f1704a89295c5897347c9d (patch)
treef34b5402f97cd826bb312e18677f3974d53bfd52 /src/gd_gif_in.c
parent385566e4ba57d803921a13306ead66f354cee0a2 (diff)
downloadlibgd-e20413bf6b872a8c23f1704a89295c5897347c9d.tar.gz
- apply same CS everywhere
Diffstat (limited to 'src/gd_gif_in.c')
-rw-r--r--src/gd_gif_in.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/gd_gif_in.c b/src/gd_gif_in.c
index fff77db..75ebddb 100644
--- a/src/gd_gif_in.c
+++ b/src/gd_gif_in.c
@@ -50,22 +50,22 @@ static int set_verbose(void)
/* We may eventually want to use this information, but def it out for now */
#if 0
static struct {
- unsigned int Width;
- unsigned int Height;
- unsigned char ColorMap[3][MAXCOLORMAPSIZE];
- unsigned int BitPixel;
- unsigned int ColorResolution;
- unsigned int Background;
- unsigned int AspectRatio;
+ unsigned int Width;
+ unsigned int Height;
+ unsigned char ColorMap[3][MAXCOLORMAPSIZE];
+ unsigned int BitPixel;
+ unsigned int ColorResolution;
+ unsigned int Background;
+ unsigned int AspectRatio;
} GifScreen;
#endif
#if 0
static struct {
- int transparent;
- int delayTime;
- int inputFlag;
- int disposal;
+ int transparent;
+ int delayTime;
+ int inputFlag;
+ int disposal;
} Gif89 = { -1, -1, -1, 0 };
#endif
@@ -234,12 +234,12 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr fd)
im->interlace = BitSet(buf[8], INTERLACE);
if(!useGlobalColormap) {
- if(ReadColorMap(fd, bitPixel, localColorMap)) {
+ if(ReadColorMap(fd, bitPixel, localColorMap)) {
gdImageDestroy(im);
return 0;
}
- ReadImage(im, fd, width, height, localColorMap, BitSet(buf[8], INTERLACE), &ZeroDataBlock);
+ ReadImage(im, fd, width, height, localColorMap, BitSet(buf[8], INTERLACE), &ZeroDataBlock);
} else {
if(!haveGlobalColormap) {
gdImageDestroy(im);
@@ -251,7 +251,7 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr fd)
if(Transparent != (-1)) {
gdImageColorTransparent(im, Transparent);
- }
+ }
goto terminated;
}
@@ -276,7 +276,7 @@ terminated:
} else {
break;
}
- }
+ }
return im;
}
@@ -306,24 +306,24 @@ DoExtension(gdIOCtx *fd, int label, int *Transparent, int *ZeroDataBlockP)
unsigned char buf[256];
switch(label) {
- case 0xf9: /* Graphic Control Extension */
- memset(buf, 0, 4); /* initialize a few bytes in the case the next function fails */
- (void) GetDataBlock(fd, (unsigned char*) buf, ZeroDataBlockP);
+ case 0xf9: /* Graphic Control Extension */
+ memset(buf, 0, 4); /* initialize a few bytes in the case the next function fails */
+ (void) GetDataBlock(fd, (unsigned char*) buf, ZeroDataBlockP);
#if 0
- Gif89.disposal = (buf[0] >> 2) & 0x7;
- Gif89.inputFlag = (buf[0] >> 1) & 0x1;
- Gif89.delayTime = LM_to_uint(buf[1], buf[2]);
+ Gif89.disposal = (buf[0] >> 2) & 0x7;
+ Gif89.inputFlag = (buf[0] >> 1) & 0x1;
+ Gif89.delayTime = LM_to_uint(buf[1], buf[2]);
#endif
- if((buf[0] & 0x1) != 0) {
- *Transparent = buf[3];
- }
+ if((buf[0] & 0x1) != 0) {
+ *Transparent = buf[3];
+ }
- while(GetDataBlock(fd, (unsigned char*) buf, ZeroDataBlockP) > 0);
+ while(GetDataBlock(fd, (unsigned char*) buf, ZeroDataBlockP) > 0);
- return FALSE;
+ return FALSE;
- default:
- break;
+ default:
+ break;
}
while(GetDataBlock(fd, (unsigned char*) buf, ZeroDataBlockP) > 0);
@@ -388,7 +388,7 @@ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroD
if(scd->done) {
if(scd->curbit >= scd->lastbit) {
/* Oh well */
- }
+ }
return -1;
}
@@ -442,7 +442,7 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, i
sd->max_code = sd->clear_code + 2;
GetCode(fd, &sd->scd, 0, TRUE, ZeroDataBlockP);
-
+
sd->fresh = TRUE;
for(i = 0; i < sd->clear_code; ++i) {
@@ -460,10 +460,10 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, i
} else if(sd->fresh) {
sd->fresh = FALSE;
-
+
do {
sd->firstcode = sd->oldcode =
- GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP);
+ GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP);
} while(sd->firstcode == sd->clear_code);
return sd->firstcode;
@@ -489,7 +489,7 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, i
sd->max_code = sd->clear_code + 2;
sd->sp = sd->stack;
sd->firstcode = sd->oldcode =
- GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP);
+ GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP);
return sd->firstcode;
} else if(code == sd->end_code) {
@@ -526,7 +526,7 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, i
}
*sd->sp++ = sd->table[1][code];
-
+
if(code == sd->table[0][code]) {
/* Oh well */
}
@@ -574,25 +574,25 @@ LWZReadByte(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, in
static void
ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace, int *ZeroDataBlockP) /*1.4//, int ignore) */
{
- unsigned char c;
+ unsigned char c;
int xpos = 0, ypos = 0, pass = 0;
int v, i;
LZW_STATIC_DATA sd;
/* Initialize the Compression routines */
if(!ReadOK(fd, &c, 1)) {
- return;
+ return;
}
if(c > MAX_LWZ_BITS) {
- return;
+ return;
}
/* Stash the color map into the image */
for(i=0; (i < gdMaxColors); i++) {
- im->red[i] = cmap[CM_RED][i];
- im->green[i] = cmap[CM_GREEN][i];
- im->blue[i] = cmap[CM_BLUE][i];
+ im->red[i] = cmap[CM_RED][i];
+ im->green[i] = cmap[CM_GREEN][i];
+ im->blue[i] = cmap[CM_BLUE][i];
im->open[i] = 1;
}
@@ -629,39 +629,39 @@ ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)
xpos = 0;
if(interlace) {
switch (pass) {
- case 0:
+ case 0:
+ case 1:
+ ypos += 8;
+ break;
+ case 2:
+ ypos += 4;
+ break;
+ case 3:
+ ypos += 2;
+ break;
+ }
+
+ if(ypos >= height) {
+ ++pass;
+ switch (pass) {
case 1:
- ypos += 8;
+ ypos = 4;
break;
case 2:
- ypos += 4;
+ ypos = 2;
break;
case 3:
- ypos += 2;
+ ypos = 1;
break;
- }
-
- if(ypos >= height) {
- ++pass;
- switch (pass) {
- case 1:
- ypos = 4;
- break;
- case 2:
- ypos = 2;
- break;
- case 3:
- ypos = 1;
- break;
- default:
- goto fini;
+ default:
+ goto fini;
}
}
} else {
++ypos;
}
}
-
+
if(ypos >= height) {
break;
}