comparison src/redraw_man.c @ 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 881efcd8a18f
comparison
equal deleted inserted replaced
850:33fd5fdc8b48 851:85f22a771e4a
610 */ 610 */
611 static coord_canvas_info_t * 611 static coord_canvas_info_t *
612 coord_canvas_info_new(redraw_man_t *rdman, coord_t *coord, 612 coord_canvas_info_new(redraw_man_t *rdman, coord_t *coord,
613 mbe_t *canvas) { 613 mbe_t *canvas) {
614 coord_canvas_info_t *info; 614 coord_canvas_info_t *info;
615 static co_aix id[6] = {1, 0, 0, 0, 1, 0};
615 616
616 info = (coord_canvas_info_t *)elmpool_elm_alloc(rdman->coord_canvas_pool); 617 info = (coord_canvas_info_t *)elmpool_elm_alloc(rdman->coord_canvas_pool);
617 if(info == NULL) 618 if(info == NULL)
618 return info; 619 return info;
619 620
622 DARRAY_INIT(&info->dirty_areas); 623 DARRAY_INIT(&info->dirty_areas);
623 624
624 bzero(info->pcache_areas, sizeof(area_t) * 2); 625 bzero(info->pcache_areas, sizeof(area_t) * 2);
625 info->pcache_cur_area = &info->pcache_areas[0]; 626 info->pcache_cur_area = &info->pcache_areas[0];
626 info->pcache_last_area = &info->pcache_areas[1]; 627 info->pcache_last_area = &info->pcache_areas[1];
628 memcpy(info->cache_2_pdev, id, sizeof(co_aix) * 6);
629 memcpy(info->cache_2_pdev_rev, id, sizeof(co_aix) * 6);
630 memcpy(info->aggr_2_pdev, id, sizeof(co_aix) * 6);
631 memcpy(info->aggr_2_pdev_rev, id, sizeof(co_aix) * 6);
627 632
628 return info; 633 return info;
629 } 634 }
630 635
631 static void coord_canvas_info_free(redraw_man_t *rdman, 636 static void coord_canvas_info_free(redraw_man_t *rdman,
1749 } 1754 }
1750 1755
1751 return OK; 1756 return OK;
1752 } 1757 }
1753 1758
1759 /*! \brief Update aggregated cache_2_pdev matrix for cached coords.
1760 *
1761 * This is perfromed from root to leaves. Aggregated cache_2_pdev is
1762 * named as aggr_2_pdev field of canvas_info_t. It is the matrix to
1763 * transform a point from space of a cached coord to the space of root
1764 * coord.
1765 */
1766 static int
1767 update_aggr_pdev(redraw_man_t *rdman) {
1768 int i;
1769 coords_t *all_zeroing;
1770 coord_t *coord, *parent_cached;
1771
1772 all_zeroing = &rdman->zeroing_coords;
1773 for(i = 0; i < all_zeroing->num; i++) {
1774 coord = all_zeroing->ds[i];
1775 parent_cached = coord_get_cached(coord_get_parent(coord));
1776 matrix_mul(coord_get_2pdev(parent_cached),
1777 coord_get_2pdev(coord),
1778 coord_get_aggr2pdev(coord));
1779 matrix_mul(coord_get_2pdev_rev(coord),
1780 coord_get_2pdev_rev(parent_cached),
1781 coord_get_aggr2pdev_rev(coord));
1782 }
1783
1784 return OK;
1785 }
1786
1754 /*! \brief Add aggregated dirty areas to ancestor. 1787 /*! \brief Add aggregated dirty areas to ancestor.
1755 * 1788 *
1756 * Dirty areas are aggregated into two areas. It assumes that even or odd 1789 * Dirty areas are aggregated into two areas. It assumes that even or odd
1757 * ones are old areas or new areas repsective. So, all even ones are 1790 * ones are old areas or new areas repsective. So, all even ones are
1758 * aggregated in an area, and odd ones are in another. 1791 * aggregated in an area, and odd ones are in another.
2003 r = zeroing_rdman_coords(rdman); 2036 r = zeroing_rdman_coords(rdman);
2004 if(r != OK) 2037 if(r != OK)
2005 return ERR; 2038 return ERR;
2006 2039
2007 r = add_rdman_aggr_dirty_areas(rdman); 2040 r = add_rdman_aggr_dirty_areas(rdman);
2041 if(r != OK)
2042 return ERR;
2043
2044 r = update_aggr_pdev(rdman);
2008 if(r != OK) 2045 if(r != OK)
2009 return ERR; 2046 return ERR;
2010 2047
2011 /* 2048 /*
2012 * Clear all flags setted by zeroing. 2049 * Clear all flags setted by zeroing.