#include <cairo.h>
#include "mb_tools.h"
#include "mb_types.h"
#include "mb_observer.h"
Go to the source code of this file.
Classes | |
struct | _free_obj |
struct | _free_objs |
struct | _redraw_man |
Manage redrawing of shapes (graphic elements). More... | |
Defines | |
#define | rdman_shape_man(rdman, shape) STAILQ_INS_TAIL(rdman->shapes, shape_t, sh_next, shape) |
Make a shape been managed by a redraw manager. | |
#define | rdman_paint_man(rdman, paint) STAILQ_INS_TAIL(rdman->paints, paint_t, pnt_next, shape) |
#define | shnode_free(rdman, node) elmpool_elm_free((rdman)->shnode_pool, node) |
#define | shnode_list_free(rdman, q) |
#define | _rdman_paint_child(rdman, paint, shape) |
#define | _rdman_paint_remove_child(rdman, paint, shape) |
#define | rdman_paint_fill(rdman, paint, shape) |
#define | rdman_paint_stroke(rdman, paint, shape) |
#define | rdman_get_ob_factory(rdman) (&(rdman)->ob_factory) |
#define | rdman_get_redraw_subject(rdman) ((rdman)->redraw) |
Typedefs | |
typedef struct _redraw_man | redraw_man_t |
typedef void(* | free_func_t )(redraw_man_t *rdman, void *obj) |
typedef struct _free_obj | free_obj_t |
typedef struct _free_objs | free_objs_t |
Functions | |
DARRAY (coords, coord_t *) | |
DARRAY (geos, geo_t *) | |
DARRAY (areas, area_t *) | |
int | redraw_man_init (redraw_man_t *rdman, cairo_t *cr, cairo_t *backend) |
void | redraw_man_destroy (redraw_man_t *rdman) |
int | rdman_find_overlaid_shapes (redraw_man_t *rdman, geo_t *geo, geo_t ***overlays) |
int | rdman_add_shape (redraw_man_t *rdman, shape_t *shape, coord_t *coord) |
int | rdman_shape_free (redraw_man_t *rdman, shape_t *shape) |
Remove a shape object from redraw manager. | |
int | rdman_paint_free (redraw_man_t *rdman, paint_t *paint) |
coord_t * | rdman_coord_new (redraw_man_t *rdman, coord_t *parent) |
int | rdman_coord_free (redraw_man_t *rdman, coord_t *coord) |
Free a coord of a redraw_man_t object. | |
int | rdman_coord_subtree_free (redraw_man_t *rdman, coord_t *subtree) |
int | rdman_coord_changed (redraw_man_t *rdman, coord_t *coord) |
Mark a coord is changed. | |
int | rdman_shape_changed (redraw_man_t *rdman, shape_t *shape) |
Mark a shape is changed. | |
int | rdman_redraw_changed (redraw_man_t *rdman) |
Re-draw all changed shapes or shapes affected by changed coords. | |
int | rdman_redraw_all (redraw_man_t *rdman) |
int | rdman_redraw_area (redraw_man_t *rdman, co_aix x, co_aix y, co_aix w, co_aix h) |
geo_t * | rdman_geos (redraw_man_t *rdman, geo_t *last) |
int | rdman_force_clean (redraw_man_t *rdman) |
shnode_t * | shnode_new (redraw_man_t *rdman, shape_t *shape) |
void | _rdman_paint_real_remove_child (redraw_man_t *rdman, paint_t *paint, shape_t *shape) |
int | rdman_paint_changed (redraw_man_t *rdman, paint_t *paint) |
shape_t * | find_shape_at_pos (redraw_man_t *rdman, co_aix x, co_aix y, int *in_stroke) |
#define _rdman_paint_child | ( | rdman, | |||
paint, | |||||
shape | ) |
Value:
do { \ shnode_t *__node; \ if((shape)->fill != (paint) && \ (shape)->stroke != (paint)) { \ __node = shnode_new(rdman, shape); \ STAILQ_INS_TAIL((paint)->members, \ shnode_t, next, __node); \ } \ } while(0)
Definition at line 116 of file mb_redraw_man.h.
#define _rdman_paint_remove_child | ( | rdman, | |||
paint, | |||||
shape | ) |
Value:
do { \ if((shape)->fill == (shape)->stroke && \ (shape)->stroke == paint) \ break; \ _rdman_paint_real_remove_child(rdman, paint, shape); \ } while(0)
Definition at line 129 of file mb_redraw_man.h.
#define rdman_get_ob_factory | ( | rdman | ) | (&(rdman)->ob_factory) |
Definition at line 156 of file mb_redraw_man.h.
#define rdman_get_redraw_subject | ( | rdman | ) | ((rdman)->redraw) |
Definition at line 157 of file mb_redraw_man.h.
#define rdman_paint_fill | ( | rdman, | |||
paint, | |||||
shape | ) |
Value:
do { \ if((shape)->fill == paint) \ break; \ _rdman_paint_remove_child(rdman, paint, shape); \ _rdman_paint_child(rdman, paint, shape); \ (shape)->fill = paint; \ } while(0)
Definition at line 136 of file mb_redraw_man.h.
#define rdman_paint_man | ( | rdman, | |||
paint | ) | STAILQ_INS_TAIL(rdman->paints, paint_t, pnt_next, shape) |
Definition at line 86 of file mb_redraw_man.h.
#define rdman_paint_stroke | ( | rdman, | |||
paint, | |||||
shape | ) |
Value:
do { \ if((shape)->stroke == paint) \ break; \ _rdman_paint_remove_child(rdman, paint, shape); \ _rdman_paint_child(rdman, paint, shape); \ (shape)->stroke = paint; \ } while(0)
Definition at line 144 of file mb_redraw_man.h.
#define rdman_shape_man | ( | rdman, | |||
shape | ) | STAILQ_INS_TAIL(rdman->shapes, shape_t, sh_next, shape) |
#define shnode_free | ( | rdman, | |||
node | ) | elmpool_elm_free((rdman)->shnode_pool, node) |
Definition at line 102 of file mb_redraw_man.h.
#define shnode_list_free | ( | rdman, | |||
q | ) |
Value:
do { \ shnode_t *__node, *__last; \ __last = STAILQ_HEAD(q); \ if(__last == NULL) break; \ for(__node = STAILQ_NEXT(shnode_t, next, __last); \ __node != NULL; \ __node = STAILQ_NEXT(shnode_t, next, __node)) { \ shnode_free(rdman, __last); \ __last = __node; \ } \ shnode_free(rdman, __last); \ } while(0)
Definition at line 103 of file mb_redraw_man.h.
typedef void(* free_func_t)(redraw_man_t *rdman, void *obj) |
Definition at line 11 of file mb_redraw_man.h.
typedef struct _free_obj free_obj_t |
Definition at line 16 of file mb_redraw_man.h.
typedef struct _free_objs free_objs_t |
Definition at line 21 of file mb_redraw_man.h.
typedef struct _redraw_man redraw_man_t |
Definition at line 9 of file mb_redraw_man.h.
void _rdman_paint_real_remove_child | ( | redraw_man_t * | rdman, | |
paint_t * | paint, | |||
shape_t * | shape | |||
) |
Definition at line 497 of file redraw_man.c.
DARRAY | ( | areas | , | |
area_t * | ||||
) |
DARRAY | ( | geos | , | |
geo_t * | ||||
) |
DARRAY | ( | coords | , | |
coord_t * | ||||
) |
shape_t* find_shape_at_pos | ( | redraw_man_t * | rdman, | |
co_aix | x, | |||
co_aix | y, | |||
int * | in_stroke | |||
) |
int rdman_add_shape | ( | redraw_man_t * | rdman, | |
shape_t * | shape, | |||
coord_t * | coord | |||
) |
Definition at line 390 of file redraw_man.c.
int rdman_coord_changed | ( | redraw_man_t * | rdman, | |
coord_t * | coord | |||
) |
Mark a coord is changed.
A changed coord_t object is marked as dirty and put into dirty_coords list. rdman_coord_changed() should be called for a coord after it been changed to notify redraw manager to redraw shapes grouped by it.
Definition at line 644 of file redraw_man.c.
int rdman_coord_free | ( | redraw_man_t * | rdman, | |
coord_t * | coord | |||
) |
Free a coord of a redraw_man_t object.
coord | is a coord_t without children and members. |
Definition at line 557 of file redraw_man.c.
coord_t* rdman_coord_new | ( | redraw_man_t * | rdman, | |
coord_t * | parent | |||
) |
int rdman_coord_subtree_free | ( | redraw_man_t * | rdman, | |
coord_t * | subtree | |||
) |
Definition at line 610 of file redraw_man.c.
int rdman_find_overlaid_shapes | ( | redraw_man_t * | rdman, | |
geo_t * | geo, | |||
geo_t *** | overlays | |||
) |
int rdman_force_clean | ( | redraw_man_t * | rdman | ) |
Definition at line 1245 of file redraw_man.c.
geo_t* rdman_geos | ( | redraw_man_t * | rdman, | |
geo_t * | last | |||
) |
Definition at line 1221 of file redraw_man.c.
int rdman_paint_changed | ( | redraw_man_t * | rdman, | |
paint_t * | paint | |||
) |
Definition at line 697 of file redraw_man.c.
int rdman_paint_free | ( | redraw_man_t * | rdman, | |
paint_t * | paint | |||
) |
Definition at line 467 of file redraw_man.c.
int rdman_redraw_all | ( | redraw_man_t * | rdman | ) |
Definition at line 1180 of file redraw_man.c.
int rdman_redraw_area | ( | redraw_man_t * | rdman, | |
co_aix | x, | |||
co_aix | y, | |||
co_aix | w, | |||
co_aix | h | |||
) |
Definition at line 1205 of file redraw_man.c.
int rdman_redraw_changed | ( | redraw_man_t * | rdman | ) |
Re-draw all changed shapes or shapes affected by changed coords.
A coord object has a geo to keep track the range that it's members will draw on. Geo of a coord should be recomputed when the coord is changed. Geo of a coord used to accelerate finding overlay shape objects of a specified geo. A coord object also must be recomputed when one of it's members is changed.
New and old geo values of a coord object that is recomputed for changing of it-self must be used to find overlay shape objects. New and old geo values of a shape should also be used to find overlay shape objects, too. If a shape's coord is changed, shape's geo object is not used to find overlay shape objects any more.
steps:
dirty flag of coord objects is cleared after update. dirty flag of geo objects is also cleared after recomputing. Clean dirty flag can prevent redundant computing for geo and corod objects.
Draw shapes in preorder of coord tree and support opacity rules.
Definition at line 1116 of file redraw_man.c.
int rdman_shape_changed | ( | redraw_man_t * | rdman, | |
shape_t * | shape | |||
) |
Mark a shape is changed.
The geo_t object of a changed shape is mark as dirty and put into dirty_geos list.
Definition at line 693 of file redraw_man.c.
int rdman_shape_free | ( | redraw_man_t * | rdman, | |
shape_t * | shape | |||
) |
Remove a shape object from redraw manager.
Removing shapes or coords when a rdman is dirty, removing is postponsed.
Definition at line 421 of file redraw_man.c.
void redraw_man_destroy | ( | redraw_man_t * | rdman | ) |
Definition at line 318 of file redraw_man.c.
int redraw_man_init | ( | redraw_man_t * | rdman, | |
cairo_t * | cr, | |||
cairo_t * | backend | |||
) |
Definition at line 238 of file redraw_man.c.
shnode_t* shnode_new | ( | redraw_man_t * | rdman, | |
shape_t * | shape | |||
) |
Definition at line 456 of file redraw_man.c.