Mercurial > MadButterfly
changeset 851:85f22a771e4a abs_n_rel_center
Compute aggregated cache_2_pdev and reversed one
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 20 Sep 2010 22:43:43 +0800 |
parents | 33fd5fdc8b48 |
children | 0027379c962e |
files | include/mb_types.h src/redraw_man.c |
diffstat | 2 files changed, 42 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/include/mb_types.h Mon Sep 20 22:43:43 2010 +0800 +++ b/include/mb_types.h Mon Sep 20 22:43:43 2010 +0800 @@ -178,6 +178,9 @@ co_aix cache_2_pdev[6]; /*!< Transfrom matrix from space of * cached one to its parent. */ co_aix cache_2_pdev_rev[6]; /*!< Reverse of cache_2_pdev. */ + co_aix aggr_2_pdev[6]; /*!< Aggregation of cache_2_pdev from root */ + co_aix aggr_2_pdev_rev[6]; /*!< Aggregation of cache_2_pdev_rev + * from root */ } coord_canvas_info_t; /*! \brief A coordination system. @@ -372,6 +375,8 @@ ((coord)->canvas_info->aggr_dirty_areas) #define coord_get_2pdev(coord) ((coord)->canvas_info->cache_2_pdev) #define coord_get_2pdev_rev(coord) ((coord)->canvas_info->cache_2_pdev_rev) +#define coord_get_aggr2pdev(coord) ((coord)->canvas_info->aggr_2_pdev) +#define coord_get_aggr2pdev_rev(coord) ((coord)->canvas_info->aggr_2_pdev_rev) /* @} */
--- a/src/redraw_man.c Mon Sep 20 22:43:43 2010 +0800 +++ b/src/redraw_man.c Mon Sep 20 22:43:43 2010 +0800 @@ -612,6 +612,7 @@ coord_canvas_info_new(redraw_man_t *rdman, coord_t *coord, mbe_t *canvas) { coord_canvas_info_t *info; + static co_aix id[6] = {1, 0, 0, 0, 1, 0}; info = (coord_canvas_info_t *)elmpool_elm_alloc(rdman->coord_canvas_pool); if(info == NULL) @@ -624,6 +625,10 @@ bzero(info->pcache_areas, sizeof(area_t) * 2); info->pcache_cur_area = &info->pcache_areas[0]; info->pcache_last_area = &info->pcache_areas[1]; + memcpy(info->cache_2_pdev, id, sizeof(co_aix) * 6); + memcpy(info->cache_2_pdev_rev, id, sizeof(co_aix) * 6); + memcpy(info->aggr_2_pdev, id, sizeof(co_aix) * 6); + memcpy(info->aggr_2_pdev_rev, id, sizeof(co_aix) * 6); return info; } @@ -1751,6 +1756,34 @@ return OK; } +/*! \brief Update aggregated cache_2_pdev matrix for cached coords. + * + * This is perfromed from root to leaves. Aggregated cache_2_pdev is + * named as aggr_2_pdev field of canvas_info_t. It is the matrix to + * transform a point from space of a cached coord to the space of root + * coord. + */ +static int +update_aggr_pdev(redraw_man_t *rdman) { + int i; + coords_t *all_zeroing; + coord_t *coord, *parent_cached; + + all_zeroing = &rdman->zeroing_coords; + for(i = 0; i < all_zeroing->num; i++) { + coord = all_zeroing->ds[i]; + parent_cached = coord_get_cached(coord_get_parent(coord)); + matrix_mul(coord_get_2pdev(parent_cached), + coord_get_2pdev(coord), + coord_get_aggr2pdev(coord)); + matrix_mul(coord_get_2pdev_rev(coord), + coord_get_2pdev_rev(parent_cached), + coord_get_aggr2pdev_rev(coord)); + } + + return OK; +} + /*! \brief Add aggregated dirty areas to ancestor. * * Dirty areas are aggregated into two areas. It assumes that even or odd @@ -2008,6 +2041,10 @@ if(r != OK) return ERR; + r = update_aggr_pdev(rdman); + if(r != OK) + return ERR; + /* * Clear all flags setted by zeroing. */