comparison src/redraw_man.c @ 57:ab028c9f0930

Ability to hidden shapes and action of visibility.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 10 Aug 2008 20:25:14 +0800
parents 8d219ebd729e
children 1ca417f741f1
comparison
equal deleted inserted replaced
56:e444a8c01735 57:ab028c9f0930
392 } 392 }
393 return OK; 393 return OK;
394 } 394 }
395 395
396 /* Clean dirties */ 396 /* Clean dirties */
397
398 static int is_coord_subtree_hidden(coord_t *coord) {
399 while(coord) {
400 if(coord->flags & COF_HIDDEN)
401 return 1;
402 coord = coord->parent;
403 }
404 return 0;
405 }
397 406
398 static void clean_shape(shape_t *shape) { 407 static void clean_shape(shape_t *shape) {
399 switch(shape->sh_type) { 408 switch(shape->sh_type) {
400 case SHT_PATH: 409 case SHT_PATH:
401 sh_path_transform(shape); 410 sh_path_transform(shape);
411 sh_dummy_transform(shape); 420 sh_dummy_transform(shape);
412 break; 421 break;
413 #endif /* UNITTEST */ 422 #endif /* UNITTEST */
414 } 423 }
415 shape->geo->flags &= ~GEF_DIRTY; 424 shape->geo->flags &= ~GEF_DIRTY;
425
426 if(is_coord_subtree_hidden(shape->coord))
427 shape->geo->flags |= GEF_HIDDEN;
428 else
429 shape->geo->flags &= ~GEF_HIDDEN;
416 } 430 }
417 431
418 static int clean_coord(coord_t *coord) { 432 static int clean_coord(coord_t *coord) {
419 shape_t *shape; 433 shape_t *shape;
420 geo_t *geo; 434 geo_t *geo;
649 for(visit_geo = STAILQ_HEAD(rdman->all_geos); 663 for(visit_geo = STAILQ_HEAD(rdman->all_geos);
650 visit_geo != NULL; 664 visit_geo != NULL;
651 visit_geo = STAILQ_NEXT(geo_t, next, visit_geo)) { 665 visit_geo = STAILQ_NEXT(geo_t, next, visit_geo)) {
652 if(visit_geo->flags & GEF_DIRTY) 666 if(visit_geo->flags & GEF_DIRTY)
653 clean_shape(visit_geo->shape); 667 clean_shape(visit_geo->shape);
668 if(visit_geo->flags & GEF_HIDDEN)
669 continue;
654 for(i = 0; i < n_areas; i++) { 670 for(i = 0; i < n_areas; i++) {
655 if(is_overlay(visit_geo->cur_area, areas[i])) { 671 if(is_overlay(visit_geo->cur_area, areas[i])) {
656 draw_shape(rdman, visit_geo->shape); 672 draw_shape(rdman, visit_geo->shape);
657 break; 673 break;
658 } 674 }
731 clean_canvas(rdman->cr); 747 clean_canvas(rdman->cr);
732 748
733 for(geo = STAILQ_HEAD(rdman->all_geos); 749 for(geo = STAILQ_HEAD(rdman->all_geos);
734 geo != NULL; 750 geo != NULL;
735 geo = STAILQ_NEXT(geo_t, next, geo)) { 751 geo = STAILQ_NEXT(geo_t, next, geo)) {
752 if(geo->flags & GEF_HIDDEN)
753 continue;
736 draw_shape(rdman, geo->shape); 754 draw_shape(rdman, geo->shape);
737 } 755 }
738 copy_cr_2_backend(rdman, 0, NULL); 756 copy_cr_2_backend(rdman, 0, NULL);
739 rdman->n_dirty_areas = 0; 757 rdman->n_dirty_areas = 0;
740 758