# HG changeset patch # User Thinker K.F. Li # Date 1221397705 -28800 # Node ID 257a1d314bcd6f2247bbb01e0d8e03f5ec91a22f # Parent c9c6810a96c1743d566e9f0ba21052c4739c5f7c Bug of insert sort diff -r c9c6810a96c1 -r 257a1d314bcd src/animate.c --- a/src/animate.c Sun Sep 14 18:53:17 2008 +0800 +++ b/src/animate.c Sun Sep 14 21:08:25 2008 +0800 @@ -103,6 +103,11 @@ mb_word_t words[1]; }; +/*! \brief Create a program object. + * + * \param max_words is maximum number of words the program can hold. + * \param rdman is a rdman that show graphics manipulated by it. + */ mb_progm_t *mb_progm_new(int max_words, redraw_man_t *rdman) { mb_progm_t *progm; int i; diff -r c9c6810a96c1 -r 257a1d314bcd src/redraw_man.c --- a/src/redraw_man.c Sun Sep 14 18:53:17 2008 +0800 +++ b/src/redraw_man.c Sun Sep 14 21:08:25 2008 +0800 @@ -43,7 +43,7 @@ for(i = 1; i < num; i++) { val = *(unsigned int *)(elms[i] + off); - for(j = i - 1; j > 0; j--) { + for(j = i; j > 0; j--) { if(*(unsigned int *)(elms[j - 1] + off) <= val) break; elms[j] = elms[j - 1]; @@ -984,6 +984,7 @@ shape_t shape; co_aix x, y; co_aix w, h; + int trans_cnt; int draw_cnt; }; @@ -1000,6 +1001,7 @@ dummy->y = y; dummy->w = w; dummy->h = h; + dummy->trans_cnt = 0; dummy->draw_cnt = 0; return (shape_t *)dummy; @@ -1030,6 +1032,7 @@ if(shape->geo) geo_from_positions(shape->geo, 2, poses); } + dummy->trans_cnt++; } void sh_dummy_fill(shape_t *shape, cairo_t *cr) { @@ -1134,16 +1137,20 @@ rdman_add_shape(rdman, shapes[i], coords[i]); } rdman_redraw_all(rdman); + CU_ASSERT(dummys[0]->trans_cnt == 1); + CU_ASSERT(dummys[1]->trans_cnt == 1); + CU_ASSERT(dummys[2]->trans_cnt == 1); CU_ASSERT(dummys[0]->draw_cnt == 1); CU_ASSERT(dummys[1]->draw_cnt == 1); CU_ASSERT(dummys[2]->draw_cnt == 1); coords[2]->matrix[2] = 100; coords[2]->matrix[5] = 100; + rdman_coord_changed(rdman, coords[0]); rdman_coord_changed(rdman, coords[2]); rdman_redraw_changed(rdman); - CU_ASSERT(dummys[0]->draw_cnt == 1); + CU_ASSERT(dummys[0]->draw_cnt == 2); CU_ASSERT(dummys[1]->draw_cnt == 2); CU_ASSERT(dummys[2]->draw_cnt == 2);