comparison src/redraw_man.c @ 33:d82749f77108

Fix bug of demo and remove *_fill() and *_stroke(). - logical error in X_main.c.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 06 Aug 2008 00:40:04 +0800
parents e06a4a667ce2
children 581a03196093
comparison
equal deleted inserted replaced
32:69c8e264890d 33:d82749f77108
526 526
527 #ifndef UNITTEST 527 #ifndef UNITTEST
528 static void set_shape_stroke_param(shape_t *shape, cairo_t *cr) { 528 static void set_shape_stroke_param(shape_t *shape, cairo_t *cr) {
529 cairo_set_line_width(cr, shape->stroke_width); 529 cairo_set_line_width(cr, shape->stroke_width);
530 } 530 }
531
532 static void fill_path_preserve(redraw_man_t *rdman) {
533 cairo_fill_preserve(rdman->cr);
534 }
535
536 static void fill_path(redraw_man_t *rdman) {
537 cairo_fill(rdman->cr);
538 }
539
540 static void stroke_path(redraw_man_t *rdman) {
541 cairo_stroke(rdman->cr);
542 }
531 #else 543 #else
532 static void set_shape_stroke_param(shape_t *shape, cairo_t *cr) { 544 static void set_shape_stroke_param(shape_t *shape, cairo_t *cr) {
533 } 545 }
546
547 static void fill_path_preserve(redraw_man_t *rdman) {
548 }
549
550 static void fill_path(redraw_man_t *rdman) {
551 }
552
553 static void stroke_path(redraw_man_t *rdman) {
554 }
534 #endif 555 #endif
535 556
536 static void draw_shape(redraw_man_t *rdman, shape_t *shape) { 557 static void draw_shape(redraw_man_t *rdman, shape_t *shape) {
537 paint_t *fill, *stroke; 558 paint_t *fill, *stroke;
538 559
539 fill = shape->fill; 560 if(shape->fill || shape->stroke) {
540 if(fill) {
541 fill->prepare(fill, rdman->cr);
542 switch(shape->sh_type) { 561 switch(shape->sh_type) {
543 case SHT_PATH: 562 case SHT_PATH:
544 sh_path_fill(shape, rdman->cr); 563 sh_path_draw(shape, rdman->cr);
545 break; 564 break;
546 case SHT_TEXT: 565 case SHT_TEXT:
547 sh_text_fill(shape, rdman->cr); 566 sh_text_draw(shape, rdman->cr);
548 break; 567 break;
549 #ifdef UNITTEST 568 #ifdef UNITTEST
550 default: 569 default:
551 sh_dummy_fill(shape, rdman->cr); 570 sh_dummy_fill(shape, rdman->cr);
552 break; 571 break;
553 #endif /* UNITTEST */ 572 #endif /* UNITTEST */
554 } 573 }
555 } 574
556 stroke = shape->stroke; 575 fill = shape->fill;
557 if(stroke) { 576 if(shape->fill) {
558 stroke->prepare(stroke, rdman->cr); 577 fill->prepare(fill, rdman->cr);
559 set_shape_stroke_param(shape, rdman->cr); 578 if(shape->stroke)
560 switch(shape->sh_type) { 579 fill_path_preserve(rdman);
561 case SHT_PATH: 580 else
562 sh_path_stroke(shape, rdman->cr); 581 fill_path(rdman);
563 break; 582 }
564 case SHT_TEXT: 583
565 sh_text_stroke(shape, rdman->cr); 584 stroke = shape->stroke;
566 break; 585 if(stroke) {
567 #ifdef UNITTEST 586 stroke->prepare(stroke, rdman->cr);
568 default: 587 set_shape_stroke_param(shape, rdman->cr);
569 /* sh_dummy_fill(shape, rdman->cr); */ 588 stroke_path(rdman);
570 break;
571 #endif /* UNITTEST */
572 } 589 }
573 } 590 }
574 } 591 }
575 592
576 #ifndef UNITTEST 593 #ifndef UNITTEST