From 0f109512fde45684fe36e84101a84f7280b28394 Mon Sep 17 00:00:00 2001 From: inmarket Date: Fri, 9 May 2014 21:33:33 +1000 Subject: [PATCH] gwinImage animated gif bug fix --- src/gwin/gimage.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gwin/gimage.c b/src/gwin/gimage.c index 07d27dd0..9d6363ba 100644 --- a/src/gwin/gimage.c +++ b/src/gwin/gimage.c @@ -26,10 +26,20 @@ static void _destroy(GWindowObject *gh) { #if GWIN_NEED_IMAGE_ANIMATION static void _redraw(GHandle gh); - static void _timer(void *gh) { + static void _timer(void *param) { + #define gh ((GHandle)param) + // We need to re-test the visibility in case it has been made invisible since the last frame. - if ((((GHandle)gh)->flags & GWIN_FLG_VISIBLE)) - _redraw((GHandle)gh); + if ((gh->flags & GWIN_FLG_VISIBLE)) { + // Setting the clip here shouldn't be necessary if the redraw doesn't overdraw + // but we put it in for safety anyway + #if GDISP_NEED_CLIP + gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height); + #endif + _redraw(gh); + } + + #undef gh } #endif