Mercurial > MadButterfly
changeset 839:a3be0162bf44
Move decision of dirty pcache_area to one place.
Move all decision logic to add_rdman_coords_pcache_area().
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 17 Sep 2010 12:21:36 +0800 |
parents | d08b4fa3a784 |
children | 048cc704bef7 |
files | src/redraw_man.c |
diffstat | 1 files changed, 27 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/redraw_man.c Fri Sep 17 12:21:36 2010 +0800 +++ b/src/redraw_man.c Fri Sep 17 12:21:36 2010 +0800 @@ -1439,19 +1439,12 @@ /* Dirty areas of cached one is added after update pcache_areas. */ - if(!coord_is_cached(coord)) { - add_dirty_area(rdman, coord, coord->cur_area); - add_dirty_area(rdman, coord, coord->last_area); - } - + add_dirty_area(rdman, coord, coord->cur_area); + add_dirty_area(rdman, coord, coord->last_area); + coord_clear_flags(coord, COF_DIRTY); coord_set_flags(coord, COF_JUST_CLEAN); - FORCHILDREN(coord, child) { - if(coord_is_cached(child)) - add_dirty_pcache_area_coord(rdman, child); - } - return OK; } @@ -1713,7 +1706,6 @@ for(i = all_zeroing->num - 1; i >= 0; i--) { coord = all_zeroing->ds[i]; zeroing_coord(rdman, coord); - compute_pcache_area(coord); } return OK; @@ -1931,6 +1923,26 @@ return OK; } +static int +add_rdman_coords_pcache_area(redraw_man_t *rdman) { + coord_t *root, *cur; + coord_t *parent; + + root = rdman->root_coord; + FOR_COORDS_POSTORDER(root, cur) { + if(coord_is_root(cur)) + continue; + if(!coord_is_cached(cur)) + continue; + if(!coord_get_flags(cur, COF_JUST_ZERO | COF_JUST_CLEAN)) { + parent = coord_get_parent(cur); + if(!coord_get_flags(parent, COF_JUST_CLEAN)) + continue; + } + add_dirty_pcache_area_coord(rdman, cur); + } +} + /*! \brief Swap geo_t::cur_area and geo_t::last_area for a geo_t. * * It is call by rdman_clean_dirties() to swap areas for members of @@ -2039,6 +2051,10 @@ if(r != OK) return ERR; + r = add_rdman_coords_pcache_area(rdman); + if(r != OK) + return ERR; + r = compute_rdman_coords_pcache_area(rdman); if(r != OK) return ERR;