comparison src/redraw_man.c @ 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 0b66b585b364
children 048cc704bef7
comparison
equal deleted inserted replaced
838:d08b4fa3a784 839:a3be0162bf44
1437 if(r != OK) 1437 if(r != OK)
1438 return ERR; 1438 return ERR;
1439 1439
1440 /* Dirty areas of cached one is added after update pcache_areas. 1440 /* Dirty areas of cached one is added after update pcache_areas.
1441 */ 1441 */
1442 if(!coord_is_cached(coord)) { 1442 add_dirty_area(rdman, coord, coord->cur_area);
1443 add_dirty_area(rdman, coord, coord->cur_area); 1443 add_dirty_area(rdman, coord, coord->last_area);
1444 add_dirty_area(rdman, coord, coord->last_area); 1444
1445 }
1446
1447 coord_clear_flags(coord, COF_DIRTY); 1445 coord_clear_flags(coord, COF_DIRTY);
1448 coord_set_flags(coord, COF_JUST_CLEAN); 1446 coord_set_flags(coord, COF_JUST_CLEAN);
1449
1450 FORCHILDREN(coord, child) {
1451 if(coord_is_cached(child))
1452 add_dirty_pcache_area_coord(rdman, child);
1453 }
1454 1447
1455 return OK; 1448 return OK;
1456 } 1449 }
1457 1450
1458 /*! \brief Clean coord_t objects. 1451 /*! \brief Clean coord_t objects.
1711 * cached coord would not effect it when zeroing. 1704 * cached coord would not effect it when zeroing.
1712 */ 1705 */
1713 for(i = all_zeroing->num - 1; i >= 0; i--) { 1706 for(i = all_zeroing->num - 1; i >= 0; i--) {
1714 coord = all_zeroing->ds[i]; 1707 coord = all_zeroing->ds[i];
1715 zeroing_coord(rdman, coord); 1708 zeroing_coord(rdman, coord);
1716 compute_pcache_area(coord);
1717 } 1709 }
1718 1710
1719 return OK; 1711 return OK;
1720 } 1712 }
1721 1713
1927 for(i = 0; i < n_dpca_coords; i++) { 1919 for(i = 0; i < n_dpca_coords; i++) {
1928 coord_clear_flags(dpca_coords[i], COF_TEMP_MARK); 1920 coord_clear_flags(dpca_coords[i], COF_TEMP_MARK);
1929 } 1921 }
1930 1922
1931 return OK; 1923 return OK;
1924 }
1925
1926 static int
1927 add_rdman_coords_pcache_area(redraw_man_t *rdman) {
1928 coord_t *root, *cur;
1929 coord_t *parent;
1930
1931 root = rdman->root_coord;
1932 FOR_COORDS_POSTORDER(root, cur) {
1933 if(coord_is_root(cur))
1934 continue;
1935 if(!coord_is_cached(cur))
1936 continue;
1937 if(!coord_get_flags(cur, COF_JUST_ZERO | COF_JUST_CLEAN)) {
1938 parent = coord_get_parent(cur);
1939 if(!coord_get_flags(parent, COF_JUST_CLEAN))
1940 continue;
1941 }
1942 add_dirty_pcache_area_coord(rdman, cur);
1943 }
1932 } 1944 }
1933 1945
1934 /*! \brief Swap geo_t::cur_area and geo_t::last_area for a geo_t. 1946 /*! \brief Swap geo_t::cur_area and geo_t::last_area for a geo_t.
1935 * 1947 *
1936 * It is call by rdman_clean_dirties() to swap areas for members of 1948 * It is call by rdman_clean_dirties() to swap areas for members of
2034 r = add_rdman_zeroing_coords(rdman); 2046 r = add_rdman_zeroing_coords(rdman);
2035 if(r != OK) 2047 if(r != OK)
2036 return ERR; 2048 return ERR;
2037 2049
2038 r = zeroing_rdman_coords(rdman); 2050 r = zeroing_rdman_coords(rdman);
2051 if(r != OK)
2052 return ERR;
2053
2054 r = add_rdman_coords_pcache_area(rdman);
2039 if(r != OK) 2055 if(r != OK)
2040 return ERR; 2056 return ERR;
2041 2057
2042 r = compute_rdman_coords_pcache_area(rdman); 2058 r = compute_rdman_coords_pcache_area(rdman);
2043 if(r != OK) 2059 if(r != OK)