diff src/shape_rect.c @ 873:881efcd8a18f abs_n_rel_center

Merge from default branch
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 24 Sep 2010 16:06:42 +0800
parents 9a7ac4487849
children a8d20bc8ce40
line wrap: on
line diff
--- a/src/shape_rect.c	Tue Sep 21 00:40:36 2010 +0800
+++ b/src/shape_rect.c	Fri Sep 24 16:06:42 2010 +0800
@@ -12,10 +12,16 @@
     co_aix w, h;
     co_aix rx, ry;
     co_aix poses[12][2];
+
+    redraw_man_t *rdman;	/*!< \brief This is used by sh_rect_free() */
 } sh_rect_t;
 
+int _sh_rect_size = sizeof(sh_rect_t);
+
 static void sh_rect_free(shape_t *shape) {
-    free(shape);
+    sh_rect_t *rect = (sh_rect_t *)shape;
+    
+    elmpool_elm_free(rect->rdman->sh_rect_pool, rect);
 }
 
 shape_t *rdman_shape_rect_new(redraw_man_t *rdman,
@@ -23,7 +29,7 @@
 			      co_aix rx, co_aix ry) {
     sh_rect_t *rect;
 
-    rect = (sh_rect_t *)malloc(sizeof(sh_rect_t));
+    rect = (sh_rect_t *)elmpool_elm_alloc(rdman->sh_rect_pool);
     if(rect == NULL)
 	return NULL;
 
@@ -37,6 +43,7 @@
     rect->rx = rx;
     rect->ry = ry;
     rect->shape.free = sh_rect_free;
+    rect->rdman = rdman;
 
     rdman_shape_man(rdman, (shape_t *)rect);