From 904138046562de55e4e1f59233ea7a0b44923839 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Sun, 4 Oct 2009 05:21:52 +0000 Subject: [PATCH] gif counter --- src/sdl-instead/SDL_anigif.c | 5 ++--- src/sdl-instead/graphics.c | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sdl-instead/SDL_anigif.c b/src/sdl-instead/SDL_anigif.c index 5630648..2717647 100644 --- a/src/sdl-instead/SDL_anigif.c +++ b/src/sdl-instead/SDL_anigif.c @@ -275,7 +275,7 @@ int AG_LoadGIF_RW( SDL_RWops* src, AG_Frame* frames, int maxFrames, int *loop) gd = malloc( sizeof(*gd) ); memset( gd, 0, sizeof(*gd) ); gd->src = src; - + gd->loop = 1; start = SDL_RWtell( src ); if ( !SDL_RWread(src,buf,6,1) ) @@ -448,9 +448,8 @@ static int DoExtension( gifdata* gd, int label ) break; if (buf[0] != 1) break; - gd->loop = buf[1] | (buf[2] << 8); + gd->loop = (unsigned int)buf[1] | (((unsigned int)buf[2]) << 8); break; - case 0xfe: /* Comment Extension */ while ( GetDataBlock(gd,buf) != 0 ) ; diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c index 647479a..735e739 100644 --- a/src/sdl-instead/graphics.c +++ b/src/sdl-instead/graphics.c @@ -651,8 +651,10 @@ int gfx_frame_gif(img_t img) if ((timer_counter - ag->delay) < (ag->frames[ag->cur_frame].delay / HZ)) return 0; + + if (ag->loop > 1 || !ag->loop) + anigif_disposal(ag); - anigif_disposal(ag); ag->cur_frame ++; if (ag->cur_frame >= ag->nr_frames) {