Mercurial > MadButterfly
comparison src/redraw_man.c @ 818:86f2c59cef09
Fix typo on index of matrix
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 13 Sep 2010 20:39:22 +0800 |
parents | 387d1c597632 |
children | 586e50f82c1f ea544a68f55d |
comparison
equal
deleted
inserted
replaced
817:387d1c597632 | 818:86f2c59cef09 |
---|---|
1280 matrix = coord->matrix; | 1280 matrix = coord->matrix; |
1281 parent = coord->parent; | 1281 parent = coord->parent; |
1282 paggr = coord_get_aggr_matrix(parent); | 1282 paggr = coord_get_aggr_matrix(parent); |
1283 | 1283 |
1284 scale_x = matrix[0] / aggr[0]; | 1284 scale_x = matrix[0] / aggr[0]; |
1285 scale_y = matrix[3] / aggr[3]; | 1285 scale_y = matrix[4] / aggr[4]; |
1286 shift_x = matrix[2] - scale_x * aggr[2]; | 1286 shift_x = matrix[2] - scale_x * aggr[2]; |
1287 shift_y = matrix[5] - scale_y * aggr[5]; | 1287 shift_y = matrix[5] - scale_y * aggr[5]; |
1288 | 1288 |
1289 canvas2p[0] = scale_x; | 1289 canvas2p[0] = scale_x; |
1290 canvas2p[1] = 0; | 1290 canvas2p[1] = 0; |
1577 */ | 1577 */ |
1578 preorder_coord_skip_subtree(cur); | 1578 preorder_coord_skip_subtree(cur); |
1579 } | 1579 } |
1580 /* Shift space */ | 1580 /* Shift space */ |
1581 aggr = coord_get_aggr_matrix(cur); | 1581 aggr = coord_get_aggr_matrix(cur); |
1582 aggr[3] -= min_x; | 1582 aggr[2] -= min_x; |
1583 aggr[5] -= min_y; | 1583 aggr[5] -= min_y; |
1584 | 1584 |
1585 FOR_COORD_MEMBERS(coord, geo) { | 1585 FOR_COORD_MEMBERS(coord, geo) { |
1586 /* \see GEO_SWAP() */ | 1586 /* \see GEO_SWAP() */ |
1587 if(!geo_get_flags(geo, GEF_SWAP)) | 1587 if(!geo_get_flags(geo, GEF_SWAP)) |
2781 | 2781 |
2782 CU_ASSERT(coord->canvas_info == rdman->root_coord->canvas_info); | 2782 CU_ASSERT(coord->canvas_info == rdman->root_coord->canvas_info); |
2783 } | 2783 } |
2784 | 2784 |
2785 static void | 2785 static void |
2786 test_own_canvas_area(void) { | |
2787 redraw_man_t *rdman; | |
2788 redraw_man_t _rdman; | |
2789 coord_t *coord1, *coord2; | |
2790 sh_dummy_t *sh; | |
2791 | |
2792 redraw_man_init(&_rdman, NULL, NULL); | |
2793 rdman = &_rdman; | |
2794 | |
2795 coord1 = rdman_coord_new(rdman, rdman->root_coord); | |
2796 CU_ASSERT(coord1->parent == rdman->root_coord); | |
2797 | |
2798 coord2 = rdman_coord_new(rdman, coord1); | |
2799 CU_ASSERT(coord2->parent == coord1); | |
2800 | |
2801 coord_set_opacity(coord2, 0.9); | |
2802 rdman_coord_changed(rdman, coord2); | |
2803 | |
2804 sh = (shape_t *)sh_dummy_new(rdman, 100, 100, 20, 20); | |
2805 rdman_add_shape(rdman, (shape_t *)sh, coord2); | |
2806 rdman_shape_changed(rdman, (shape_t *)sh); | |
2807 | |
2808 clean_coord(rdman, coord2); | |
2809 | |
2810 /* Parent cached coord must be updated */ | |
2811 CU_ASSERT(geo_get_area(coord2)->x == 100); | |
2812 CU_ASSERT(geo_get_area(coord2)->y == 100); | |
2813 CU_ASSERT(geo_get_area(coord2)->w <= 22 && geo_get_area(coord2)->w >= 19); | |
2814 CU_ASSERT(geo_get_area(coord2)->h <= 22 && geo_get_area(coord2)->h >= 19); | |
2815 } | |
2816 | |
2817 static void | |
2786 test_own_canvas(void) { | 2818 test_own_canvas(void) { |
2787 redraw_man_t *rdman; | 2819 redraw_man_t *rdman; |
2788 redraw_man_t _rdman; | 2820 redraw_man_t _rdman; |
2789 coord_t *coord1, *coord2; | 2821 coord_t *coord1, *coord2; |
2790 sh_dummy_t *sh; | 2822 sh_dummy_t *sh; |
2806 rdman_shape_changed(rdman, (shape_t *)sh); | 2838 rdman_shape_changed(rdman, (shape_t *)sh); |
2807 | 2839 |
2808 rdman_clean_dirties(rdman); | 2840 rdman_clean_dirties(rdman); |
2809 | 2841 |
2810 /* Parent cached coord must be updated */ | 2842 /* Parent cached coord must be updated */ |
2811 CU_ASSERT(_coord_get_dirty_areas(rdman->root_coord)->num >= 1); | 2843 CU_ASSERT(_coord_get_dirty_areas(rdman->root_coord)->num == 1); |
2844 | |
2845 CU_ASSERT(geo_get_area(coord2)->x == 0); | |
2846 CU_ASSERT(geo_get_area(coord2)->y == 0); | |
2847 CU_ASSERT(geo_get_area(coord2)->w <= 22 && geo_get_area(coord2)->w >= 19); | |
2848 CU_ASSERT(geo_get_area(coord2)->h <= 22 && geo_get_area(coord2)->h >= 19); | |
2849 | |
2850 CU_ASSERT(geo_get_area(coord1)->x == 100); | |
2851 CU_ASSERT(geo_get_area(coord1)->y == 100); | |
2852 CU_ASSERT(geo_get_area(coord1)->w <= 22 && geo_get_area(coord1)->w >= 19); | |
2853 CU_ASSERT(geo_get_area(coord1)->h <= 22 && geo_get_area(coord1)->h >= 19); | |
2812 } | 2854 } |
2813 | 2855 |
2814 CU_pSuite get_redraw_man_suite(void) { | 2856 CU_pSuite get_redraw_man_suite(void) { |
2815 CU_pSuite suite; | 2857 CU_pSuite suite; |
2816 | 2858 |
2817 suite = CU_add_suite("Suite_redraw_man", NULL, NULL); | 2859 suite = CU_add_suite("Suite_redraw_man", NULL, NULL); |
2818 CU_ADD_TEST(suite, test_rdman_redraw_changed); | 2860 CU_ADD_TEST(suite, test_rdman_redraw_changed); |
2819 CU_ADD_TEST(suite, test_rdman_free_objs); | 2861 CU_ADD_TEST(suite, test_rdman_free_objs); |
2820 CU_ADD_TEST(suite, test_setup_canvas_info); | 2862 CU_ADD_TEST(suite, test_setup_canvas_info); |
2863 CU_ADD_TEST(suite, test_own_canvas_area); | |
2821 CU_ADD_TEST(suite, test_own_canvas); | 2864 CU_ADD_TEST(suite, test_own_canvas); |
2822 | 2865 |
2823 return suite; | 2866 return suite; |
2824 } | 2867 } |
2825 | 2868 |