Mercurial > MadButterfly
comparison src/redraw_man.c @ 824:93c54322d4d8
Do not copy canvas for unittest
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 14 Sep 2010 05:44:48 +0800 |
parents | ea544a68f55d |
children | e83956ba22d7 |
comparison
equal
deleted
inserted
replaced
823:ea544a68f55d | 824:93c54322d4d8 |
---|---|
2187 } | 2187 } |
2188 #endif /* UNITTEST */ | 2188 #endif /* UNITTEST */ |
2189 | 2189 |
2190 static void update_cached_canvas_2_parent(redraw_man_t *rdman, | 2190 static void update_cached_canvas_2_parent(redraw_man_t *rdman, |
2191 coord_t *coord) { | 2191 coord_t *coord) { |
2192 #ifndef UNITTEST | |
2192 mbe_t *pcanvas, *canvas; | 2193 mbe_t *pcanvas, *canvas; |
2193 mbe_surface_t *surface; | 2194 mbe_surface_t *surface; |
2194 mbe_pattern_t *pattern; | 2195 mbe_pattern_t *pattern; |
2195 co_aix reverse[6]; | 2196 co_aix reverse[6]; |
2196 co_aix canvas2pdev_matrix[6]; | 2197 co_aix canvas2pdev_matrix[6]; |
2206 surface = mbe_get_target(canvas); | 2207 surface = mbe_get_target(canvas); |
2207 pattern = mbe_pattern_create_for_surface(surface); | 2208 pattern = mbe_pattern_create_for_surface(surface); |
2208 mbe_pattern_set_matrix(pattern, reverse); | 2209 mbe_pattern_set_matrix(pattern, reverse); |
2209 mbe_set_source(pcanvas, pattern); | 2210 mbe_set_source(pcanvas, pattern); |
2210 mbe_paint_with_alpha(pcanvas, coord->opacity); | 2211 mbe_paint_with_alpha(pcanvas, coord->opacity); |
2212 #endif | |
2211 } | 2213 } |
2212 | 2214 |
2213 static int draw_coord_shapes_in_dirty_areas(redraw_man_t *rdman, | 2215 static int draw_coord_shapes_in_dirty_areas(redraw_man_t *rdman, |
2214 coord_t *coord) { | 2216 coord_t *coord) { |
2215 int dirty = 0; | 2217 int dirty = 0; |
2856 test_own_canvas_redraw(void) { | 2858 test_own_canvas_redraw(void) { |
2857 redraw_man_t *rdman; | 2859 redraw_man_t *rdman; |
2858 redraw_man_t _rdman; | 2860 redraw_man_t _rdman; |
2859 coord_t *coord1, *coord2; | 2861 coord_t *coord1, *coord2; |
2860 sh_dummy_t *sh; | 2862 sh_dummy_t *sh; |
2863 paint_t *paint; | |
2861 | 2864 |
2862 redraw_man_init(&_rdman, NULL, NULL); | 2865 redraw_man_init(&_rdman, NULL, NULL); |
2863 rdman = &_rdman; | 2866 rdman = &_rdman; |
2864 | 2867 |
2865 coord1 = rdman_coord_new(rdman, rdman->root_coord); | 2868 coord1 = rdman_coord_new(rdman, rdman->root_coord); |
2873 | 2876 |
2874 sh = (shape_t *)sh_dummy_new(rdman, 100, 100, 20, 20); | 2877 sh = (shape_t *)sh_dummy_new(rdman, 100, 100, 20, 20); |
2875 rdman_add_shape(rdman, (shape_t *)sh, coord2); | 2878 rdman_add_shape(rdman, (shape_t *)sh, coord2); |
2876 rdman_shape_changed(rdman, (shape_t *)sh); | 2879 rdman_shape_changed(rdman, (shape_t *)sh); |
2877 | 2880 |
2878 rdman_redraw_changed(rdman); | 2881 paint = dummy_paint_new(rdman); |
2882 rdman_paint_fill(rdman, paint, (shape_t *)sh); | |
2883 | |
2884 rdman_redraw_all(rdman); | |
2879 | 2885 |
2880 CU_ASSERT(sh->draw_cnt == 1); | 2886 CU_ASSERT(sh->draw_cnt == 1); |
2881 | 2887 |
2888 rdman_paint_free(rdman, paint); | |
2882 redraw_man_destroy(rdman); | 2889 redraw_man_destroy(rdman); |
2883 } | 2890 } |
2884 | 2891 |
2885 CU_pSuite get_redraw_man_suite(void) { | 2892 CU_pSuite get_redraw_man_suite(void) { |
2886 CU_pSuite suite; | 2893 CU_pSuite suite; |