Mercurial > MadButterfly
diff src/redraw_man.c @ 146:e96a584487af
Use elmpool to manage paint_color_t objects.
- Add a paint_color_pool member for redraw_man_t.
- Initialize and free when redraw_man_init() and redraw_man_destroy().
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Thu, 25 Sep 2008 09:53:05 +0800 |
parents | e89512d6fa0a |
children | 995ee8fd5f1a |
line wrap: on
line diff
--- a/src/redraw_man.c Thu Sep 25 02:13:50 2008 +0800 +++ b/src/redraw_man.c Thu Sep 25 09:53:05 2008 +0800 @@ -196,6 +196,7 @@ int redraw_man_init(redraw_man_t *rdman, cairo_t *cr, cairo_t *backend) { extern void redraw_man_destroy(redraw_man_t *rdman); + extern int paint_color_size; memset(rdman, 0, sizeof(redraw_man_t)); @@ -233,6 +234,16 @@ return ERR; } + rdman->paint_color_pool = elmpool_new(paint_color_size, 64); + if(rdman->subject_pool == NULL) { + elmpool_free(rdman->geo_pool); + elmpool_free(rdman->coord_pool); + elmpool_free(rdman->shnode_pool); + elmpool_free(rdman->observer_pool); + elmpool_free(rdman->subject_pool); + return ERR; + } + rdman->ob_factory.subject_alloc = ob_subject_alloc; rdman->ob_factory.subject_free = ob_subject_free; rdman->ob_factory.observer_alloc = ob_observer_alloc; @@ -272,6 +283,7 @@ elmpool_free(rdman->shnode_pool); elmpool_free(rdman->observer_pool); elmpool_free(rdman->subject_pool); + elmpool_free(rdman->paint_color_pool); if(rdman->dirty_coords) free(rdman->dirty_coords); if(rdman->dirty_geos) @@ -553,6 +565,7 @@ } } +/*! \todo Use a static variable to hold positions array for clean_coord()? */ static int clean_coord(redraw_man_t *rdman, coord_t *coord) { geo_t *geo; co_aix (*poses)[2];