From 28f4ac22ce67e90190dd868c532846da57676968 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 9 Jan 2017 10:22:55 +1000 Subject: [PATCH] Fix window manager redraw problem with multi-tasking and large images --- src/gwin/gwin_wm.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gwin/gwin_wm.c b/src/gwin/gwin_wm.c index 3f50b4fc..c0ea8d25 100644 --- a/src/gwin/gwin_wm.c +++ b/src/gwin/gwin_wm.c @@ -746,18 +746,23 @@ static void WM_Delete(GHandle gh) { } static void WM_Redraw(GHandle gh) { + uint32_t flags; + + flags = gh->flags; + gh->flags &= ~(GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW|GWIN_FLG_PARENTREVEAL); + #if GWIN_NEED_CONTAINERS redo_redraw: #endif - if ((gh->flags & GWIN_FLG_SYSVISIBLE)) { + if ((flags & GWIN_FLG_SYSVISIBLE)) { if (gh->vmt->Redraw) gh->vmt->Redraw(gh); - else if ((gh->flags & GWIN_FLG_BGREDRAW)) { + else if ((flags & GWIN_FLG_BGREDRAW)) { // We can't redraw but we want full coverage so just clear the area gdispGFillArea(gh->display, gh->x, gh->y, gh->width, gh->height, gh->bgcolor); // Only do an after clear if this is not a parent reveal - if (!(gh->flags & GWIN_FLG_PARENTREVEAL) && gh->vmt->AfterClear) + if (!(flags & GWIN_FLG_PARENTREVEAL) && gh->vmt->AfterClear) gh->vmt->AfterClear(gh); } @@ -765,10 +770,9 @@ static void WM_Redraw(GHandle gh) { // If this is container but not a parent reveal, mark any visible children for redraw // We redraw our children here as we have overwritten them in redrawing the parent // as GDISP/GWIN doesn't support complex clipping regions. - if ((gh->flags & (GWIN_FLG_CONTAINER|GWIN_FLG_PARENTREVEAL)) == GWIN_FLG_CONTAINER) { + if ((flags & (GWIN_FLG_CONTAINER|GWIN_FLG_PARENTREVEAL)) == GWIN_FLG_CONTAINER) { // Container redraw is done - gh->flags &= ~(GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW|GWIN_FLG_PARENTREVEAL); for(gh = gwinGetFirstChild(gh); gh; gh = gwinGetSibling(gh)) _gwinUpdate(gh); @@ -777,14 +781,12 @@ static void WM_Redraw(GHandle gh) { #endif } else { - if ((gh->flags & GWIN_FLG_BGREDRAW)) { + if ((flags & GWIN_FLG_BGREDRAW)) { GHandle gx; #if GWIN_NEED_CONTAINERS if (gh->parent) { // Child redraw is done - gh->flags &= ~(GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW|GWIN_FLG_PARENTREVEAL); - // Get the parent to redraw the area gh = gh->parent; @@ -817,9 +819,6 @@ static void WM_Redraw(GHandle gh) { } } - - // Redraw is done - gh->flags &= ~(GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW|GWIN_FLG_PARENTREVEAL); } static void WM_Size(GHandle gh, coord_t w, coord_t h) {