From 79117a49ad8b913f16365e5fea4cf50aa9346f7f Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Fri, 13 Jun 2008 23:58:15 -0700 Subject: whatever --- Makefile | 2 +- src/gif.c | 17 +++++++++++++---- src/main.c | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 50dc6b8..03f7b66 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ SRCFILES := $(wildcard src/*.c) OBJFILES := $(SRCFILES:%.c=%.o) DEPFILES := $(OBJFILES:%.o=%.d) CLEANFILES := $(CLEANFILES) $(DEPFILES) $(OBJFILES) meh -CFLAGS := -O3 -Wall -g -ggdb +CFLAGS := $(CFLAGS) -O3 -Wall -g -ggdb LIBS := -lX11 -ljpeg -lpng meh: $(OBJFILES) 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; + } } } } diff --git a/src/main.c b/src/main.c index c116fab..41b09ce 100644 --- a/src/main.c +++ b/src/main.c @@ -206,6 +206,7 @@ void run(struct imagenode *image){ case MapNotify: break; case ConfigureNotify: + printf("ConfigureNotify\n"); if(width != event.xconfigure.width || height != event.xconfigure.height){ if(img){ free(img->data); @@ -272,6 +273,7 @@ void run(struct imagenode *image){ free(tmp); } setaspect(bufwidth, bufheight); + printf("setaspect\n"); } if(!img){ if(width * bufheight > height * bufwidth){ @@ -293,6 +295,7 @@ void run(struct imagenode *image){ yoffset = 0; } img = create_image_from_buffer(buf, imagewidth, imageheight, bufwidth, bufheight); + printf("img\n"); assert(img); } XFillRectangle(display, window, gc, 0, 0, fillw, fillh); -- cgit v1.2.3