Mercurial > MadButterfly
diff src/mb_types.h @ 138:9f4fc9ecfd1f
Make shapes and coords drawed in post-order of tree.
1. Add opacity for each coord.
2. Trival and draw tree of shapes and coords in post-order.
3. Coords have a before_pmem member variable to note it's order been draw.
It is relative to it's siblings and member shapes of parent coord.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 22 Sep 2008 11:45:00 +0800 |
parents | ea758bb3bbe2 |
children | 1695a4b02b14 |
line wrap: on
line diff
--- a/src/mb_types.h Fri Sep 19 09:53:17 2008 +0800 +++ b/src/mb_types.h Mon Sep 22 11:45:00 2008 +0800 @@ -88,6 +88,14 @@ typedef struct _coord { unsigned int order; unsigned int flags; + co_aix opacity; + /*! Own one or inherit from an ancestor. + * Setup it when clean coords. + * \sa + * - \ref COF_OWN_CANVAS + * - \ref redraw + */ + cairo_t *canvas; area_t *cur_area, *last_area; area_t areas[2]; @@ -97,12 +105,17 @@ struct _coord *parent; STAILQ(struct _coord) children; struct _coord *sibling; + unsigned int before_pmem; /*!< \brief The coord is before nth member + * of parent. */ STAILQ(shape_t) members; /*!< All shape_t objects in this coord. */ subject_t *mouse_event; } coord_t; #define COF_DIRTY 0x1 #define COF_HIDDEN 0x2 +#define COF_OWN_CANVAS 0x4 /*!< A coord owns a canvas or inherit it + * from an ancestor. + */ extern void coord_init(coord_t *co, coord_t *parent); extern void coord_trans_pos(coord_t *co, co_aix *x, co_aix *y); @@ -110,6 +123,7 @@ extern void compute_aggr_of_coord(coord_t *coord); extern void update_aggr_matrix(coord_t *start); extern coord_t *preorder_coord_subtree(coord_t *root, coord_t *last); +extern coord_t *postorder_coord_subtree(coord_t *root, coord_t *last); #define coord_hide(co) do { co->flags |= COF_HIDDEN; } while(0) #define coord_show(co) do { co->flags &= ~COF_HIDDEN; } while(0) #define coord_get_mouse_event(coord) ((coord)->mouse_event)