comparison src/redraw_man.c @ 20:74d3d5dc9aaa

rename XXX_draw() to XXX_fill()
author Thinker K.F. Li <thinker@branda.to>
date Sat, 02 Aug 2008 15:46:26 +0800
parents cf6d65398619
children 8fcf2d878ecd
comparison
equal deleted inserted replaced
19:cf6d65398619 20:74d3d5dc9aaa
15 15
16 #ifdef UNITTEST 16 #ifdef UNITTEST
17 typedef struct _sh_dummy sh_dummy_t; 17 typedef struct _sh_dummy sh_dummy_t;
18 18
19 extern void sh_dummy_transform(shape_t *shape); 19 extern void sh_dummy_transform(shape_t *shape);
20 extern void sh_dummy_draw(shape_t *, cairo_t *); 20 extern void sh_dummy_fill(shape_t *, cairo_t *);
21 #endif /* UNITTEST */ 21 #endif /* UNITTEST */
22 22
23 /*! \brief Sort a list of element by a unsigned integer. 23 /*! \brief Sort a list of element by a unsigned integer.
24 * 24 *
25 * The result is in ascend order. The unsigned integers is 25 * The result is in ascend order. The unsigned integers is
458 458
459 /* Drawing and Redrawing 459 /* Drawing and Redrawing
460 * ============================================================ 460 * ============================================================
461 */ 461 */
462 462
463 static void draw_shape(redraw_man_t *rdman, shape_t *shape) { 463 static void fill_shape(redraw_man_t *rdman, shape_t *shape) {
464 paint_t *fill; 464 paint_t *fill;
465 465
466 fill = shape->fill; 466 fill = shape->fill;
467 if(fill) { 467 if(fill) {
468 fill->prepare(fill, rdman->cr); 468 fill->prepare(fill, rdman->cr);
469 switch(shape->sh_type) { 469 switch(shape->sh_type) {
470 case SHT_PATH: 470 case SHT_PATH:
471 sh_path_draw(shape, rdman->cr); 471 sh_path_fill(shape, rdman->cr);
472 break; 472 break;
473 #ifdef UNITTEST 473 #ifdef UNITTEST
474 default: 474 default:
475 sh_dummy_draw(shape, rdman->cr); 475 sh_dummy_fill(shape, rdman->cr);
476 break; 476 break;
477 #endif /* UNITTEST */ 477 #endif /* UNITTEST */
478 } 478 }
479 } 479 }
480 } 480 }
518 518
519 static void reset_clip(redraw_man_t *rdman) { 519 static void reset_clip(redraw_man_t *rdman) {
520 } 520 }
521 #endif /* UNITTEST */ 521 #endif /* UNITTEST */
522 522
523 static void draw_shapes_in_areas(redraw_man_t *rdman, 523 static void fill_shapes_in_areas(redraw_man_t *rdman,
524 int n_areas, 524 int n_areas,
525 area_t **areas) { 525 area_t **areas) {
526 geo_t *visit_geo; 526 geo_t *visit_geo;
527 int i; 527 int i;
528 528
531 visit_geo = STAILQ_NEXT(geo_t, next, visit_geo)) { 531 visit_geo = STAILQ_NEXT(geo_t, next, visit_geo)) {
532 if(visit_geo->flags & GEF_DIRTY) 532 if(visit_geo->flags & GEF_DIRTY)
533 clean_shape(visit_geo->shape); 533 clean_shape(visit_geo->shape);
534 for(i = 0; i < n_areas; i++) { 534 for(i = 0; i < n_areas; i++) {
535 if(is_overlay(visit_geo->cur_area, areas[i])) { 535 if(is_overlay(visit_geo->cur_area, areas[i])) {
536 draw_shape(rdman, visit_geo->shape); 536 fill_shape(rdman, visit_geo->shape);
537 break; 537 break;
538 } 538 }
539 } 539 }
540 } 540 }
541 } 541 }
601 601
602 n_dirty_areas = rdman->n_dirty_areas; 602 n_dirty_areas = rdman->n_dirty_areas;
603 dirty_areas = rdman->dirty_areas; 603 dirty_areas = rdman->dirty_areas;
604 if(n_dirty_areas > 0) { 604 if(n_dirty_areas > 0) {
605 make_clip(rdman, n_dirty_areas, dirty_areas); 605 make_clip(rdman, n_dirty_areas, dirty_areas);
606 draw_shapes_in_areas(rdman, n_dirty_areas, dirty_areas); 606 fill_shapes_in_areas(rdman, n_dirty_areas, dirty_areas);
607 rdman->n_dirty_areas = 0; 607 rdman->n_dirty_areas = 0;
608 reset_clip(rdman); 608 reset_clip(rdman);
609 } 609 }
610 rdman->n_dirty_areas = 0; 610 rdman->n_dirty_areas = 0;
611 611
621 for(geo = STAILQ_HEAD(rdman->all_geos); 621 for(geo = STAILQ_HEAD(rdman->all_geos);
622 geo != NULL; 622 geo != NULL;
623 geo = STAILQ_NEXT(geo_t, next, geo)) { 623 geo = STAILQ_NEXT(geo_t, next, geo)) {
624 if(geo->flags & GEF_DIRTY) 624 if(geo->flags & GEF_DIRTY)
625 clean_shape(geo->shape); 625 clean_shape(geo->shape);
626 draw_shape(rdman, geo->shape); 626 fill_shape(rdman, geo->shape);
627 } 627 }
628 628
629 return OK; 629 return OK;
630 } 630 }
631 631
772 if(shape->geo) 772 if(shape->geo)
773 geo_from_positions(shape->geo, 2, poses); 773 geo_from_positions(shape->geo, 2, poses);
774 } 774 }
775 } 775 }
776 776
777 void sh_dummy_draw(shape_t *shape, cairo_t *cr) { 777 void sh_dummy_fill(shape_t *shape, cairo_t *cr) {
778 sh_dummy_t *dummy; 778 sh_dummy_t *dummy;
779 779
780 dummy = (sh_dummy_t *)shape; 780 dummy = (sh_dummy_t *)shape;
781 dummy->draw_cnt++; 781 dummy->draw_cnt++;
782 } 782 }