From 5a22e67680923e3087540df64ff5eb104f44e72d Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Wed, 25 Mar 2020 17:28:31 +0800 Subject: [PATCH] bugfixing: bad implementation of generate_dirty_region; generate_dirty_region -> merge_dirty_region --- src/kernel/compsor-fallback.c | 36 ++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/kernel/compsor-fallback.c b/src/kernel/compsor-fallback.c index 0b2df9b8..c11040ec 100644 --- a/src/kernel/compsor-fallback.c +++ b/src/kernel/compsor-fallback.c @@ -334,9 +334,11 @@ static void composite_ppp_znodes (CompositorCtxt* ctxt) ClipRgnIntersect (&ctxt->inv_rgn, &ctxt->dirty_rgn, rgn); if (IsEmptyClipRgn (&ctxt->inv_rgn)) { ServerReleasePopupMenuZNodeHeader (zidx); - break; + _DBG_PRINTF ("ppp %d skipped\n", zidx); + continue; } else { + _DBG_PRINTF ("ppp %d composited\n", zidx); // blit this popup menu to screen SelectClipRegion (HDC_SCREEN_SYS, &ctxt->inv_rgn); BitBlt (znode_hdr->mem_dc, 0, 0, @@ -617,9 +619,10 @@ static BOOL reset_dirty_region (CompositorCtxt* ctxt, MG_Layer* layer) return TRUE; } -static BOOL generate_dirty_region (CompositorCtxt* ctxt, +static BOOL merge_dirty_region (CompositorCtxt* ctxt, const ZNODEHEADER* znode_hdr, const CLIPRGN* znode_rgn) { + EmptyClipRgn (&ctxt->inv_rgn); if (znode_hdr && znode_hdr->dirty_rcs) { int i; for (i = 0; i < znode_hdr->nr_dirty_rcs; i++) { @@ -628,16 +631,23 @@ static BOOL generate_dirty_region (CompositorCtxt* ctxt, // device coordinates to screen coordinates rc = znode_hdr->dirty_rcs [i]; OffsetRect (&rc, znode_hdr->rc.left, znode_hdr->rc.top); - AddClipRect (&ctxt->dirty_rgn, &rc); + AddClipRect (&ctxt->inv_rgn, &rc); } if (znode_rgn) - IntersectRegion (&ctxt->dirty_rgn, &ctxt->dirty_rgn, znode_rgn); + IntersectRegion (&ctxt->inv_rgn, &ctxt->inv_rgn, znode_rgn); else - IntersectClipRect (&ctxt->dirty_rgn, &ctxt->rc_screen); + IntersectClipRect (&ctxt->inv_rgn, &ctxt->rc_screen); + } - return !IsEmptyClipRgn (&ctxt->dirty_rgn); + if (IsEmptyClipRgn (&ctxt->inv_rgn)) { + return FALSE; + } + + UnionRegion (&ctxt->dirty_rgn, &ctxt->dirty_rgn, &ctxt->inv_rgn); + EmptyClipRgn (&ctxt->inv_rgn); + return TRUE; } static BOOL merge_dirty_ppp (CompositorCtxt* ctxt, MG_Layer* layer, int zidx) @@ -649,15 +659,17 @@ static BOOL merge_dirty_ppp (CompositorCtxt* ctxt, MG_Layer* layer, int zidx) _DBG_PRINTF("called: %d\n", zidx); /* the fallback compositor only manages znodes on the topmost layer. */ - if (layer != mgTopmostLayer || zidx <= 0) + if (layer != mgTopmostLayer) return rc; znode_hdr = ServerGetPopupMenuZNodeHeader (zidx, (void**)&rgn, TRUE); - if (generate_dirty_region (ctxt, znode_hdr, rgn)) { + if (merge_dirty_region (ctxt, znode_hdr, rgn)) { //ctxt->dirty_types |= DIRTY_ZT_PPP; rc = TRUE; } ServerReleasePopupMenuZNodeHeader (zidx); + + dump_region(&ctxt->dirty_rgn, __func__); return rc; } @@ -668,14 +680,14 @@ static BOOL merge_dirty_win (CompositorCtxt* ctxt, MG_Layer* layer, int zidx) CLIPRGN *rgn; /* the fallback compositor only manages znodes on the topmost layer. */ - if (layer != mgTopmostLayer || zidx <= 0) + if (layer != mgTopmostLayer) return rc; _DBG_PRINTF("called: %d\n", zidx); /* merge the dirty region */ znode_hdr = ServerGetWinZNodeHeader (NULL, zidx, (void**)&rgn, TRUE); - if (generate_dirty_region (ctxt, znode_hdr, rgn)) { + if (merge_dirty_region (ctxt, znode_hdr, rgn)) { //ctxt->dirty_types |= DIRTY_ZT_WIN; rc = TRUE; } @@ -689,7 +701,7 @@ static BOOL merge_dirty_wpp (CompositorCtxt* ctxt, MG_Layer* layer) const ZNODEHEADER* znode_hdr; znode_hdr = ServerGetWinZNodeHeader (NULL, 0, NULL, TRUE); - if (generate_dirty_region (ctxt, znode_hdr, NULL)) { + if (merge_dirty_region (ctxt, znode_hdr, NULL)) { tile_dirty_region_for_wallpaper (ctxt); //subtract_opaque_win_znodes_above (ctxt, 0); //ctxt->dirty_types |= DIRTY_ZT_WPP; @@ -710,6 +722,8 @@ BOOL refresh_dirty_region (CompositorCtxt* ctxt, MG_Layer* layer) composite_on_dirty_region (ctxt, 0); EmptyClipRgn (&ctxt->dirty_rgn); + + SyncUpdateDC (HDC_SCREEN_SYS); return TRUE; }