Mercurial > MadButterfly
comparison src/redraw_man.c @ 22:8fcf2d878ecd
shapes with stroke
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 02 Aug 2008 16:20:15 +0800 |
parents | 74d3d5dc9aaa |
children | 56f592f56ff7 |
comparison
equal
deleted
inserted
replaced
21:83d24300a992 | 22:8fcf2d878ecd |
---|---|
458 | 458 |
459 /* Drawing and Redrawing | 459 /* Drawing and Redrawing |
460 * ============================================================ | 460 * ============================================================ |
461 */ | 461 */ |
462 | 462 |
463 static void fill_shape(redraw_man_t *rdman, shape_t *shape) { | 463 static void draw_shape(redraw_man_t *rdman, shape_t *shape) { |
464 paint_t *fill; | 464 paint_t *fill, *stroke; |
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) { |
475 sh_dummy_fill(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 stroke = shape->stroke; | |
481 if(stroke) { | |
482 stroke->prepare(stroke, rdman->cr); | |
483 switch(shape->sh_type) { | |
484 case SHT_PATH: | |
485 sh_path_stroke(shape, rdman->cr); | |
486 break; | |
487 #ifdef UNITTEST | |
488 default: | |
489 /* sh_dummy_fill(shape, rdman->cr); */ | |
490 break; | |
491 #endif /* UNITTEST */ | |
492 } | |
493 } | |
480 } | 494 } |
481 | 495 |
482 #ifndef UNITTEST | 496 #ifndef UNITTEST |
483 static void clean_clip(cairo_t *cr) { | 497 static void clean_clip(cairo_t *cr) { |
484 cairo_pattern_t *pt; | 498 cairo_pattern_t *pt; |
518 | 532 |
519 static void reset_clip(redraw_man_t *rdman) { | 533 static void reset_clip(redraw_man_t *rdman) { |
520 } | 534 } |
521 #endif /* UNITTEST */ | 535 #endif /* UNITTEST */ |
522 | 536 |
523 static void fill_shapes_in_areas(redraw_man_t *rdman, | 537 static void draw_shapes_in_areas(redraw_man_t *rdman, |
524 int n_areas, | 538 int n_areas, |
525 area_t **areas) { | 539 area_t **areas) { |
526 geo_t *visit_geo; | 540 geo_t *visit_geo; |
527 int i; | 541 int i; |
528 | 542 |
531 visit_geo = STAILQ_NEXT(geo_t, next, visit_geo)) { | 545 visit_geo = STAILQ_NEXT(geo_t, next, visit_geo)) { |
532 if(visit_geo->flags & GEF_DIRTY) | 546 if(visit_geo->flags & GEF_DIRTY) |
533 clean_shape(visit_geo->shape); | 547 clean_shape(visit_geo->shape); |
534 for(i = 0; i < n_areas; i++) { | 548 for(i = 0; i < n_areas; i++) { |
535 if(is_overlay(visit_geo->cur_area, areas[i])) { | 549 if(is_overlay(visit_geo->cur_area, areas[i])) { |
536 fill_shape(rdman, visit_geo->shape); | 550 draw_shape(rdman, visit_geo->shape); |
537 break; | 551 break; |
538 } | 552 } |
539 } | 553 } |
540 } | 554 } |
541 } | 555 } |
601 | 615 |
602 n_dirty_areas = rdman->n_dirty_areas; | 616 n_dirty_areas = rdman->n_dirty_areas; |
603 dirty_areas = rdman->dirty_areas; | 617 dirty_areas = rdman->dirty_areas; |
604 if(n_dirty_areas > 0) { | 618 if(n_dirty_areas > 0) { |
605 make_clip(rdman, n_dirty_areas, dirty_areas); | 619 make_clip(rdman, n_dirty_areas, dirty_areas); |
606 fill_shapes_in_areas(rdman, n_dirty_areas, dirty_areas); | 620 draw_shapes_in_areas(rdman, n_dirty_areas, dirty_areas); |
607 rdman->n_dirty_areas = 0; | 621 rdman->n_dirty_areas = 0; |
608 reset_clip(rdman); | 622 reset_clip(rdman); |
609 } | 623 } |
610 rdman->n_dirty_areas = 0; | 624 rdman->n_dirty_areas = 0; |
611 | 625 |
621 for(geo = STAILQ_HEAD(rdman->all_geos); | 635 for(geo = STAILQ_HEAD(rdman->all_geos); |
622 geo != NULL; | 636 geo != NULL; |
623 geo = STAILQ_NEXT(geo_t, next, geo)) { | 637 geo = STAILQ_NEXT(geo_t, next, geo)) { |
624 if(geo->flags & GEF_DIRTY) | 638 if(geo->flags & GEF_DIRTY) |
625 clean_shape(geo->shape); | 639 clean_shape(geo->shape); |
626 fill_shape(rdman, geo->shape); | 640 draw_shape(rdman, geo->shape); |
627 } | 641 } |
628 | 642 |
629 return OK; | 643 return OK; |
630 } | 644 } |
631 | 645 |