comparison src/redraw_man.c @ 490:5d0b2761f89c Android_Skia

Reset stroke and fill for shapes when a paint is freed. - reset stroke or/and fill of shapes with a freeing paint. - remove a shape from member lists of paints of stroke and fill when the shape being freed.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 23 Nov 2009 18:04:22 +0800
parents 23c7667b3ec0
children 4291f16f3a09
comparison
equal deleted inserted replaced
489:23c7667b3ec0 490:5d0b2761f89c
744 } 744 }
745 if(saved_shape != NULL) 745 if(saved_shape != NULL)
746 rdman_shape_free(rdman, saved_shape); 746 rdman_shape_free(rdman, saved_shape);
747 747
748 coord_canvas_info_free(rdman, rdman->root_coord->canvas_info); 748 coord_canvas_info_free(rdman, rdman->root_coord->canvas_info);
749
750 /* XXX: paints are not freed, here. All resources of paints would
751 * be reclaimed by freeing elmpools.
752 */
749 753
750 elmpool_free(rdman->coord_pool); 754 elmpool_free(rdman->coord_pool);
751 elmpool_free(rdman->geo_pool); 755 elmpool_free(rdman->geo_pool);
752 elmpool_free(rdman->shnode_pool); 756 elmpool_free(rdman->shnode_pool);
753 elmpool_free(rdman->observer_pool); 757 elmpool_free(rdman->observer_pool);
839 if(r != OK) 843 if(r != OK)
840 return ERR; 844 return ERR;
841 return OK; 845 return OK;
842 } 846 }
843 847
848 if(shape->stroke != NULL)
849 rdman_paint_stroke(rdman, (paint_t *)NULL, shape);
850 if(shape->fill != NULL)
851 rdman_paint_fill(rdman, (paint_t *)NULL, shape);
852
844 if(geo != NULL) { 853 if(geo != NULL) {
845 subject_free(geo->mouse_event); 854 subject_free(geo->mouse_event);
846 geo_detach_coord(geo, shape->coord); 855 geo_detach_coord(geo, shape->coord);
847 sh_detach_coord(shape); 856 sh_detach_coord(shape);
848 sh_detach_geo(shape); 857 sh_detach_geo(shape);
852 mb_prop_store_destroy(&shape->obj.props); 861 mb_prop_store_destroy(&shape->obj.props);
853 shape->free(shape); 862 shape->free(shape);
854 863
855 if(rdman->last_mouse_over == (mb_obj_t *)shape) 864 if(rdman->last_mouse_over == (mb_obj_t *)shape)
856 rdman->last_mouse_over = NULL; 865 rdman->last_mouse_over = NULL;
866
857 867
858 return OK; 868 return OK;
859 } 869 }
860 870
861 shnode_t *shnode_new(redraw_man_t *rdman, shape_t *shape) { 871 shnode_t *shnode_new(redraw_man_t *rdman, shape_t *shape) {
869 return node; 879 return node;
870 } 880 }
871 881
872 int rdman_paint_free(redraw_man_t *rdman, paint_t *paint) { 882 int rdman_paint_free(redraw_man_t *rdman, paint_t *paint) {
873 shnode_t *shnode, *saved_shnode; 883 shnode_t *shnode, *saved_shnode;
884 shape_t *shape;
874 885
875 if(rdman_is_dirty(rdman)) { 886 if(rdman_is_dirty(rdman)) {
876 if(!(paint->flags & PNTF_FREE)) 887 if(!(paint->flags & PNTF_FREE))
877 return ERR; 888 return ERR;
878 add_free_obj(rdman, paint, (free_func_t)rdman_paint_free); 889 add_free_obj(rdman, paint, (free_func_t)rdman_paint_free);
883 /* Free member shapes that using this paint. */ 894 /* Free member shapes that using this paint. */
884 saved_shnode = NULL; 895 saved_shnode = NULL;
885 FORPAINTMEMBERS(paint, shnode) { 896 FORPAINTMEMBERS(paint, shnode) {
886 if(saved_shnode) { 897 if(saved_shnode) {
887 RM_PAINTMEMBER(paint, saved_shnode); 898 RM_PAINTMEMBER(paint, saved_shnode);
899
900 shape = saved_shnode->shape;
901 if(shape->stroke == paint)
902 rdman_paint_stroke(rdman, (paint_t *)NULL, shape);
903 if(shape->fill == paint)
904 rdman_paint_fill(rdman, (paint_t *)NULL, shape);
905
888 shnode_free(rdman, saved_shnode); 906 shnode_free(rdman, saved_shnode);
889 } 907 }
890 saved_shnode = shnode; 908 saved_shnode = shnode;
891 } 909 }
892 if(saved_shnode) { 910 if(saved_shnode) {
893 RM_PAINTMEMBER(paint, saved_shnode); 911 RM_PAINTMEMBER(paint, saved_shnode);
912
913 shape = saved_shnode->shape;
914 if(shape->stroke == paint)
915 rdman_paint_stroke(rdman, (paint_t *)NULL, shape);
916 if(shape->fill == paint)
917 rdman_paint_fill(rdman, (paint_t *)NULL, shape);
918
894 shnode_free(rdman, saved_shnode); 919 shnode_free(rdman, saved_shnode);
895 } 920 }
896 921
897 RM_PAINT(rdman, paint); 922 RM_PAINT(rdman, paint);
898 paint->free(rdman, paint); 923 paint->free(rdman, paint);