aboutsummaryrefslogtreecommitdiffstats
path: root/src/gif.c
diff options
context:
space:
mode:
authorJohn Hawthorn <jhawthor@uvic.ca>2008-06-13 23:58:15 -0700
committerJohn Hawthorn <jhawthor@uvic.ca>2008-06-13 23:58:15 -0700
commit79117a49ad8b913f16365e5fea4cf50aa9346f7f (patch)
tree5a2a3f3f9cadaccab6be32cd7168c9afa4d7d878 /src/gif.c
parentab9fe4157144f5293311a036576d80be6016165d (diff)
downloadmirror-meh-79117a49ad8b913f16365e5fea4cf50aa9346f7f.tar.gz
mirror-meh-79117a49ad8b913f16365e5fea4cf50aa9346f7f.tar.bz2
mirror-meh-79117a49ad8b913f16365e5fea4cf50aa9346f7f.zip
whatever
Diffstat (limited to 'src/gif.c')
-rw-r--r--src/gif.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/gif.c b/src/gif.c
index 9f4407e..676fd98 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -154,6 +154,11 @@ unsigned char *loadgif(FILE *infile, int *bufwidth, int *bufheight){
}
if(code == clearcode){
+ if(i){
+ buf[(i-1)*3] = 0xff;
+ buf[(i-1)*3+1] = 0;
+ buf[(i-1)*3+2] = 0;
+ }
clear:
printf("%i. clear\n", count);
curcodesize = initcodesize + 1;
@@ -172,9 +177,7 @@ clear:
return buf;
}else{
assert(newcode < MAX_CODES);
- printf("newcode: %x\n", newcode);
if(code <= newcode){
- printf("%i. dict\n", count);
prefix[newcode+1] = i;
length[newcode+1] = length[code] + 1;
for(a = prefix[code]; a < prefix[code] + length[code]; a++){
@@ -191,7 +194,6 @@ clear:
suffix[newcode*3 + 3] = suffix[newcode*3] = buf[prefix[newcode+1] * 3];
suffix[newcode*3 + 4] = suffix[newcode*3 + 1] = buf[prefix[newcode+1] * 3 + 1];
suffix[newcode*3 + 5] = suffix[newcode*3 + 2] = buf[prefix[newcode+1] * 3 + 2];
- printf("codes[%x] = {%x,%x,%x}\n", newcode, prefix[newcode], length[newcode], suffix[newcode]);
}else{
printf("code > newcode (%x > %x)\n", code, newcode);
return buf;
@@ -199,8 +201,15 @@ clear:
}
newcode++;
- if(newcode == 1 << curcodesize){
+ if(newcode >= 1 << curcodesize){
+ buf[(i-1)*3] = 0xff;
+ buf[(i-1)*3+1] = 0;
+ buf[(i-1)*3+2] = 0xff;
curcodesize++;
+ printf("curcodesize = %i\n", curcodesize);
+ if(curcodesize == 11){
+ curcodesize = 11;
+ }
}
}
}