extern Eina_List *evas_modules;
static int initcount = 0;
+Eina_Mempool *_evas_rectangle_mp = NULL;
+
EAPI int
evas_init(void)
{
if (initcount == 0)
{
+ const char *choice;
+
eina_init();
+
+ if (!(choice = getenv("EINA_MEMPOOL")))
+ choice = "chained_mempool";
+
+ _evas_rectangle_mp = eina_mempool_new(choice, "evas_rectangle", NULL,
+ sizeof (Evas_Rectangle), 42);
+ if (!_evas_rectangle_mp)
+ {
+ EINA_ERROR_PERR("ERROR: Mempool for rectangle cannot be allocated in list init.\n");
+ abort();
+ }
+
evas_module_init();
evas_async_events_init();
}
evas_object_image_free(Evas_Object *obj)
{
Evas_Object_Image *o;
+ Evas_Rectangle *r;
/* frees private object data. very simple here */
o = (Evas_Object_Image *)(obj->object_data);
o->engine_data);
o->engine_data = NULL;
o->magic = 0;
- while (o->pixel_updates)
- {
- Evas_Rectangle *r;
-
- r = (Evas_Rectangle *)o->pixel_updates->data;
- o->pixel_updates = eina_list_remove(o->pixel_updates, r);
- free(r);
- }
+ EINA_LIST_FREE(o->pixel_updates, r)
+ eina_mempool_free(_evas_rectangle_mp, r);
free(o);
}
(o->cur.border.t == 0) &&
(o->cur.border.b == 0))
{
- while (o->pixel_updates)
+ Evas_Rectangle *rr;
+
+ EINA_LIST_FREE(o->pixel_updates, rr)
{
- Evas_Rectangle *rr;
Evas_Coord idw, idh, idx, idy;
int x, y, w, h;
- rr = o->pixel_updates->data;
- o->pixel_updates = eina_list_remove(o->pixel_updates, rr);
obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output, o->engine_data, rr->x, rr->y, rr->w, rr->h);
-
+
idx = evas_object_image_figure_x_fill(obj, o->cur.fill.x, o->cur.fill.w, &idw);
idy = evas_object_image_figure_y_fill(obj, o->cur.fill.y, o->cur.fill.h, &idh);
idx += idw;
idy = ydy;
}
- free(rr);
+ eina_mempool_free(_evas_rectangle_mp, rr);
}
goto done;
}
{
if (o->pixel_updates)
{
- while (o->pixel_updates)
- {
- Evas_Rectangle *r;
+ Evas_Rectangle *r;
- r = (Evas_Rectangle *)o->pixel_updates->data;
- o->pixel_updates = eina_list_remove(o->pixel_updates, r);
- free(r);
- }
+ EINA_LIST_FREE(o->pixel_updates, r)
+ eina_mempool_free(_evas_rectangle_mp, r);
obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output, o->engine_data, 0, 0, o->cur.image.w, o->cur.image.h);
evas_object_render_pre_prev_cur_add(&rects, obj);
goto done;
evas_object_image_render_post(Evas_Object *obj)
{
Evas_Object_Image *o;
+ Evas_Rectangle *r;
/* this moves the current data to the previous state parts of the object */
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
o = (Evas_Object_Image *)(obj->object_data);
/* remove those pesky changes */
- while (obj->clip.changes)
- {
- Evas_Rectangle *r;
-
- r = (Evas_Rectangle *)obj->clip.changes->data;
- obj->clip.changes = eina_list_remove(obj->clip.changes, r);
- free(r);
- }
- while (o->pixel_updates)
- {
- Evas_Rectangle *r;
-
- r = (Evas_Rectangle *)o->pixel_updates->data;
- o->pixel_updates = eina_list_remove(o->pixel_updates, r);
- free(r);
- }
+ EINA_LIST_FREE(obj->clip.changes, r)
+ eina_mempool_free(_evas_rectangle_mp, r);
+ EINA_LIST_FREE(o->pixel_updates, r)
+ eina_mempool_free(_evas_rectangle_mp, r);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
o->prev = o->cur;
}
if (o->changed)
{
-/*
- Evas_Rectangle *r;
-
- r = malloc(sizeof(Evas_Rectangle));
- r->x = 0; r->y = 0;
- r->w = obj->cur.geometry.w;
- r->h = obj->cur.geometry.h;
- updates = eina_list_append(updates, r);
-*/
evas_object_render_pre_prev_cur_add(&rects, obj);
o->changed = 0;
}
evas_object_textblock_render_post(Evas_Object *obj)
{
Evas_Object_Textblock *o;
+ Evas_Rectangle *r;
/* this moves the current data to the previous state parts of the object */
/* in whatever way is safest for the object. also if we don't need object */
/* data anymore we can free it if the object deems this is a good idea */
o = (Evas_Object_Textblock *)(obj->object_data);
/* remove those pesky changes */
- while (obj->clip.changes)
- {
- Evas_Rectangle *r;
-
- r = (Evas_Rectangle *)obj->clip.changes->data;
- obj->clip.changes = eina_list_remove(obj->clip.changes, r);
- free(r);
- }
+ EINA_LIST_FREE(obj->clip.changes, r)
+ eina_mempool_free(_evas_rectangle_mp, r);
/* move cur to prev safely for object data */
obj->prev = obj->cur;
// o->prev = o->cur;
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
- r = malloc(sizeof(Evas_Rectangle));
+ NEW_RECT(r, x, y, w, h);
if (!r) return;
- r->x = x; r->y = y; r->w = w; r->h = h;
e->damages = eina_list_append(e->damages, r);
e->changed = 1;
}
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
- r = malloc(sizeof(Evas_Rectangle));
+ NEW_RECT(r, x, y, w, h);
if (!r) return;
- r->x = x; r->y = y; r->w = w; r->h = h;
e->obscures = eina_list_append(e->obscures, r);
}
EAPI void
evas_obscured_clear(Evas *e)
{
+ Evas_Rectangle *r;
+
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
- while (e->obscures)
- {
- Evas_Rectangle *r;
-
- r = (Evas_Rectangle *)e->obscures->data;
- e->obscures = eina_list_remove(e->obscures, r);
- free(r);
- }
+ EINA_LIST_FREE(e->obscures, r)
+ eina_mempool_free(_evas_rectangle_mp, r);
}
static void
}
eina_array_clean(&e->restack_objects);
/* phase 3. add exposes */
- while (e->damages)
+ EINA_LIST_FREE(e->damages, r)
{
- r = e->damages->data;
- e->damages = eina_list_remove(e->damages, r);
e->engine.func->output_redraws_rect_add(e->engine.data.output,
r->x, r->y, r->w, r->h);
- free(r);
+ eina_mempool_free(_evas_rectangle_mp, r);
}
/* phase 4. output & viewport changes */
if (e->viewport.changed)
#endif
#define NEW_RECT(_r, _x, _y, _w, _h) \
-{(_r) = malloc(sizeof(Evas_Rectangle)); \
-if (_r) \
-{ \
- (_r)->x = (_x); (_r)->y = (_y); \
- (_r)->w = (_w); (_r)->h = (_h); \
-}}
+{(_r) = eina_mempool_alloc(_evas_rectangle_mp, sizeof(Evas_Rectangle)); \
+ if (_r) \
+ { \
+ (_r)->x = (_x); (_r)->y = (_y); \
+ (_r)->w = (_w); (_r)->h = (_h); \
+ }}
#define MERR_NONE() _evas_alloc_error = EVAS_ALLOC_ERROR_NONE
#define MERR_FATAL() _evas_alloc_error = EVAS_ALLOC_ERROR_FATAL
void _evas_object_textblock_rehint(Evas_Object *obj);
extern int _evas_alloc_error;
+extern Eina_Mempool *_evas_rectangle_mp;
struct _Evas_Imaging_Image
{