comparison src/event.c @ 587:1302b336add6 openvg

Do use mbe_clip() for overlay testing
author Thinker K.F. Li <thinker@branda.to>
date Wed, 30 Jun 2010 17:27:46 +0800
parents 6e18550c8fa8
children 7b4e80ab671a
comparison
equal deleted inserted replaced
586:b42d69ab8857 587:1302b336add6
691 static 691 static
692 void _release_mbe_for_testing(mbe_t *cr) { 692 void _release_mbe_for_testing(mbe_t *cr) {
693 mbe_destroy(cr); 693 mbe_destroy(cr);
694 } 694 }
695 695
696 #ifdef OVERLAY_DRAW_TEST
697 /*
698 * Since we remove mbe_clip(), mb_objs_are_overlay() should not use
699 * clip for testing overlay anymore.
700 */
701
696 static 702 static
697 void _draw_to_mask(shape_t *shape, mbe_t *cr) { 703 void _draw_to_mask(shape_t *shape, mbe_t *cr) {
698 if(sh_get_flags(shape, GEF_OV_DRAW)) 704 if(sh_get_flags(shape, GEF_OV_DRAW))
699 return; 705 return;
700 706
726 return TRUE; 732 return TRUE;
727 } 733 }
728 734
729 return FALSE; 735 return FALSE;
730 } 736 }
737 #endif
731 738
732 /*! \brief Is a mb_obj_t overlaid with another mb_obj_t and 739 /*! \brief Is a mb_obj_t overlaid with another mb_obj_t and
733 * descendants. 740 * descendants.
734 * 741 *
735 * coord is relative less than shapes. Check areas of coord can 742 * coord is relative less than shapes. Check areas of coord can
763 770
764 r = areas_are_overlay(area, candi_area); 771 r = areas_are_overlay(area, candi_area);
765 if(!r) 772 if(!r)
766 return FALSE; 773 return FALSE;
767 774
775 #ifdef OVERLAY_DRAW_TEST
768 if(!obj_is_shape) 776 if(!obj_is_shape)
769 return TRUE; 777 return TRUE;
770 778
771 _draw_to_mask(candi_shape, cr); 779 _draw_to_mask(candi_shape, cr);
772 r = _fill_and_check(shape, cr); 780 r = _fill_and_check(shape, cr);
773 781
774 return r; 782 return r;
783 #else
784 return TRUE;
785 #endif
775 } 786 }
776 787
777 ASSERT(IS_MBO_COORD(others_root)); 788 ASSERT(IS_MBO_COORD(others_root));
778 789
779 root = (coord_t *)others_root; 790 root = (coord_t *)others_root;
788 FOR_COORD_SHAPES(candi_coord, candi_shape) { 799 FOR_COORD_SHAPES(candi_coord, candi_shape) {
789 candi_area = sh_get_area(candi_shape); 800 candi_area = sh_get_area(candi_shape);
790 r = areas_are_overlay(area, candi_area); 801 r = areas_are_overlay(area, candi_area);
791 if(!r) 802 if(!r)
792 continue; 803 continue;
793 804
805 #ifdef OVERLAY_DRAW_TEST
794 if(!obj_is_shape) 806 if(!obj_is_shape)
795 return TRUE; 807 return TRUE;
796 808
797 _draw_to_mask(candi_shape, cr); 809 _draw_to_mask(candi_shape, cr);
798 r = _fill_and_check(shape, cr); 810 r = _fill_and_check(shape, cr);
799 if(r) 811 if(r)
800 return TRUE; 812 return TRUE;
813 #else
814 return TRUE;
815 #endif
801 } 816 }
802 } 817 }
803 818
804 return FALSE; 819 return FALSE;
805 } 820 }
932 947
933 rdman_shape_free(rdman, shape); 948 rdman_shape_free(rdman, shape);
934 _free_fake_rdman(rdman); 949 _free_fake_rdman(rdman);
935 } 950 }
936 951
952 #ifdef OVERLAY_DRAW_TEST
937 static 953 static
938 void test_is_obj_objs_overlay(void) { 954 void test_is_obj_objs_overlay(void) {
939 redraw_man_t *rdman; 955 redraw_man_t *rdman;
940 coord_t *root, *coord1, *coord2; 956 coord_t *root, *coord1, *coord2;
941 shape_t *shape1, *shape2, *shape3; 957 shape_t *shape1, *shape2, *shape3;
1133 r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)shape3); 1149 r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)shape3);
1134 CU_ASSERT(!r); 1150 CU_ASSERT(!r);
1135 1151
1136 _free_fake_rdman(rdman); 1152 _free_fake_rdman(rdman);
1137 } 1153 }
1154 #endif
1138 1155
1139 CU_pSuite get_event_suite(void) { 1156 CU_pSuite get_event_suite(void) {
1140 CU_pSuite suite; 1157 CU_pSuite suite;
1141 1158
1142 suite = CU_add_suite("Suite_event", NULL, NULL); 1159 suite = CU_add_suite("Suite_event", NULL, NULL);
1143 CU_ADD_TEST(suite, test_mb_obj_pos_is_in); 1160 CU_ADD_TEST(suite, test_mb_obj_pos_is_in);
1161 #ifdef OVERLAY_DRAW_TEST
1144 CU_ADD_TEST(suite, test_is_obj_objs_overlay); 1162 CU_ADD_TEST(suite, test_is_obj_objs_overlay);
1145 CU_ADD_TEST(suite, test_mb_objs_are_overlay); 1163 CU_ADD_TEST(suite, test_mb_objs_are_overlay);
1164 #endif
1146 1165
1147 return suite; 1166 return suite;
1148 } 1167 }
1149 1168
1150 #endif /* UNITTEST */ 1169 #endif /* UNITTEST */