Mercurial > MadButterfly
comparison src/redraw_man.c @ 834:9f305d895e8f
Keep width and height of a canvas for mock of canvas
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 17 Sep 2010 12:21:35 +0800 |
parents | 419c7de41bfa |
children | 51da337879bd |
comparison
equal
deleted
inserted
replaced
833:419c7de41bfa | 834:9f305d895e8f |
---|---|
520 #ifdef UNITTEST | 520 #ifdef UNITTEST |
521 /*! \brief This is only used for unittest. | 521 /*! \brief This is only used for unittest. |
522 */ | 522 */ |
523 typedef struct { | 523 typedef struct { |
524 co_aix parent_2_cache[6]; | 524 co_aix parent_2_cache[6]; |
525 int w, h; | |
525 } mock_mbe_t; | 526 } mock_mbe_t; |
526 #endif | 527 #endif |
527 | 528 |
528 static mbe_t *canvas_new(int w, int h) { | 529 static mbe_t *canvas_new(int w, int h) { |
529 #ifndef UNITTEST | 530 #ifndef UNITTEST |
534 w, h); | 535 w, h); |
535 cr = mbe_create(surface); | 536 cr = mbe_create(surface); |
536 | 537 |
537 return cr; | 538 return cr; |
538 #else | 539 #else |
539 return (mbe_t *)malloc(sizeof(mock_mbe_t)); | 540 mock_mbe_t *mbe; |
541 | |
542 mbe = malloc(sizeof(mock_mbe_t)); | |
543 mbe->w = w; | |
544 mbe->h = h; | |
545 | |
546 return (mbe_t *)mbe; | |
540 #endif | 547 #endif |
541 } | 548 } |
542 | 549 |
543 static void canvas_free(mbe_t *canvas) { | 550 static void canvas_free(mbe_t *canvas) { |
544 #ifndef UNITTEST | 551 #ifndef UNITTEST |
554 | 561 |
555 surface = mbe_get_target(canvas); | 562 surface = mbe_get_target(canvas); |
556 *w = mbe_image_surface_get_width(surface); | 563 *w = mbe_image_surface_get_width(surface); |
557 *h = mbe_image_surface_get_height(surface); | 564 *h = mbe_image_surface_get_height(surface); |
558 #else | 565 #else |
559 *w = 0; | 566 mock_mbe_t *mbe; |
560 *h = 0; | 567 |
568 mbe = (mock_mbe_t *)canvas; | |
569 *w = mbe->w; | |
570 *h = mbe->h; | |
561 #endif | 571 #endif |
562 } | 572 } |
563 | 573 |
564 static int geo_off_in_coord(geo_t *geo, coord_t *coord) { | 574 static int geo_off_in_coord(geo_t *geo, coord_t *coord) { |
565 int off = 0; | 575 int off = 0; |
1345 matrix_trans_pos(cached2pdev, &poses[2][0], &poses[2][1]); | 1355 matrix_trans_pos(cached2pdev, &poses[2][0], &poses[2][1]); |
1346 matrix_trans_pos(cached2pdev, &poses[3][0], &poses[3][1]); | 1356 matrix_trans_pos(cached2pdev, &poses[3][0], &poses[3][1]); |
1347 | 1357 |
1348 area_init(coord_get_pcache_area(coord), 4, poses); | 1358 area_init(coord_get_pcache_area(coord), 4, poses); |
1349 | 1359 |
1350 coord_set_flags(coord, COF_DIRTY_PCACHE_AREA); | 1360 coord_clear_flags(coord, COF_DIRTY_PCACHE_AREA); |
1351 } | 1361 } |
1352 | 1362 |
1353 /*! \brief Compute area of a coord. | 1363 /*! \brief Compute area of a coord. |
1354 */ | 1364 */ |
1355 static int | 1365 static int |
2920 CU_ASSERT(parent_2_cache[5] == -100); | 2930 CU_ASSERT(parent_2_cache[5] == -100); |
2921 | 2931 |
2922 coord2->matrix[2] = 20; | 2932 coord2->matrix[2] = 20; |
2923 coord2->matrix[5] = 30; | 2933 coord2->matrix[5] = 30; |
2924 rdman_coord_changed(rdman, coord2); | 2934 rdman_coord_changed(rdman, coord2); |
2935 rdman_redraw_changed(rdman); | |
2925 | 2936 |
2926 /* To test if transform matrix of cached coord working */ | 2937 /* To test if transform matrix of cached coord working */ |
2927 parent_2_cache = ((mock_mbe_t *)_coord_get_canvas(coord2))->parent_2_cache; | 2938 parent_2_cache = ((mock_mbe_t *)_coord_get_canvas(coord2))->parent_2_cache; |
2928 CU_ASSERT(parent_2_cache[0] == 1); | 2939 CU_ASSERT(parent_2_cache[0] == 1); |
2929 CU_ASSERT(parent_2_cache[1] == 0); | 2940 CU_ASSERT(parent_2_cache[1] == 0); |