comparison src/redraw_man.c @ 135:81c03fdd94d0

-
author Thinker K.F. Li <thinker@branda.to>
date Thu, 18 Sep 2008 17:12:41 +0800
parents 4c2d83721bcc
children 9f4fc9ecfd1f
comparison
equal deleted inserted replaced
134:4d2e28188460 135:81c03fdd94d0
522 coord->flags &= ~COF_DIRTY; 522 coord->flags &= ~COF_DIRTY;
523 523
524 return OK; 524 return OK;
525 } 525 }
526 526
527 /*! \page dirty Relationships of dirty coord, geo, and area. 527 /*! \brief Clean coord_t objects.
528 * 528 *
529 * A coord_t instance is dirty if it's matrix had been changed. Once 529 * \todo Make objects can be addin or remove out of coord tree any time.
530 * it is changed, all shapes in it's descendants would be effected. 530 */
531 * Shapes in descendants are dirtied. Dirty coords and dirty shapes
532 * should be clean. The procedure of clean for dirty coords re-compute
533 * aggregated matric and areas of coords. The area of a coord is a
534 * rectangle area where member shapes of the coord occupy. Old
535 * and new value of coord area are putten into dirty area list.
536 *
537 * A dirty shape means it's geo being dirty. A dirty geo is clean by
538 * recomputing area and transform shape it-self according aggregated
539 * matrix of the coord that it is a member of. Old and new value of
540 * geo area are also putten into dirty area list.
541 *
542 * Shapes that should be redrawed are selected by if it overlaid with any
543 * of dirty areas. Once it overlaid with one or more dirty areas, it
544 * is redrawed.
545 */
546
547 static int clean_rdman_coords(redraw_man_t *rdman) { 531 static int clean_rdman_coords(redraw_man_t *rdman) {
548 coord_t *coord; 532 coord_t *coord;
549 coord_t **dirty_coords; 533 coord_t **dirty_coords;
550 int n_dirty_coords; 534 int n_dirty_coords;
551 int i, r; 535 int i, r;
747 } 731 }
748 } 732 }
749 } 733 }
750 734
751 735
736 /*! \page coord_opacity How to support opacity attribute for group (coord)?
737 *
738 * I have several ideas to do that. This page show you all ideas.
739 *
740 * \section idea_one First One
741 * Change the structure of tree of coords. It is organized as tree of
742 * SVG document, shapes and coords are putten in tree with order the same
743 * as the document. The idea can solve the problem, but also seriously
744 * impact current code.
745 *
746 * \section idea_two Second One
747 * Add opacity and agg_opacity attribute to coord_t, and update
748 *
749 */
750
752 /*! \brief Re-draw all changed shapes or shapes affected by changed coords. 751 /*! \brief Re-draw all changed shapes or shapes affected by changed coords.
753 * 752 *
754 * A coord object has a geo to keep track the range that it's members will 753 * A coord object has a geo to keep track the range that it's members will
755 * draw on. Geo of a coord should be recomputed when the coord is changed. 754 * draw on. Geo of a coord should be recomputed when the coord is changed.
756 * Geo of a coord used to accelerate finding overlay shape objects of 755 * Geo of a coord used to accelerate finding overlay shape objects of
791 return ERR; 790 return ERR;
792 791
793 n_dirty_areas = rdman->n_dirty_areas; 792 n_dirty_areas = rdman->n_dirty_areas;
794 dirty_areas = rdman->dirty_areas; 793 dirty_areas = rdman->dirty_areas;
795 if(n_dirty_areas > 0) { 794 if(n_dirty_areas > 0) {
795 /*! \brief Draw shapes in preorder of coord tree and support opacity
796 * rules.
797 */
796 clean_canvas(rdman->cr); 798 clean_canvas(rdman->cr);
797 draw_shapes_in_areas(rdman, n_dirty_areas, dirty_areas); 799 draw_shapes_in_areas(rdman, n_dirty_areas, dirty_areas);
798 copy_cr_2_backend(rdman, rdman->n_dirty_areas, rdman->dirty_areas); 800 copy_cr_2_backend(rdman, rdman->n_dirty_areas, rdman->dirty_areas);
799 rdman->n_dirty_areas = 0; 801 rdman->n_dirty_areas = 0;
800 reset_clip(rdman); 802 reset_clip(rdman);
864 node->next = NULL; 866 node->next = NULL;
865 } 867 }
866 return node; 868 return node;
867 } 869 }
868 870
869 /* 871 /*! \page dirty Dirty geo, coord, and area.
870 * Dirty of geo 872 *
873 * \section dirty_of_ego Dirty of geo
871 * A geo is dirty when any of the shape, size or positions is changed. 874 * A geo is dirty when any of the shape, size or positions is changed.
872 * It's geo and positions should be recomputed before drawing. So, 875 * It's geo and positions should be recomputed before drawing. So,
873 * dirty geos are marked as dirty and put into dirty_geos list. 876 * dirty geos are marked as dirty and put into dirty_geos list.
874 * The list is inspected before drawing to make sure the right shape, 877 * The list is inspected before drawing to make sure the right shape,
875 * size, and positions. 878 * size, and positions.
876 * 879 *
877 * Dirty of coord 880 * \section dirty_of_coord Dirty of coord
878 * A coord is dirty when it's transformation matrix being changed. 881 * A coord is dirty when it's transformation matrix being changed.
879 * Dirty coords are marked as dirty and put into dirty_coords list. 882 * Dirty coords are marked as dirty and put into dirty_coords list.
880 * Once a coord is dirty, every member geos of it are also dirty. 883 * Once a coord is dirty, every member geos of it are also dirty.
881 * Because, their shape, size and positions will be changed. But, 884 * Because, their shape, size and positions will be changed. But,
882 * they are not marked as dirty and put into dirty_geos list, since 885 * they are not marked as dirty and put into dirty_geos list, since