Enlightenment SVN wrote: > Log: > * edje_calc: Major cleanup. > - Edje_Real_Part use less memory. > - Edje_Real_Part and Edje_Real_Part_State now use a mempool. > - When both param1 and param2 are the same, only recalc param1. > - Don't compute Edje_Real_Part more than one time per > edje_recalc_do. > To this last statement...I say A MEan !! :))
> > Author: cedric > Date: 2009-08-14 10:19:42 -0700 (Fri, 14 Aug 2009) > New Revision: 41771 > > Modified: > trunk/edje/src/lib/edje_calc.c trunk/edje/src/lib/edje_edit.c > trunk/edje/src/lib/edje_embryo.c trunk/edje/src/lib/edje_load.c > trunk/edje/src/lib/edje_main.c trunk/edje/src/lib/edje_private.h > > Modified: trunk/edje/src/lib/edje_calc.c > =================================================================== > --- trunk/edje/src/lib/edje_calc.c 2009-08-14 17:17:01 UTC (rev 41770) > +++ trunk/edje/src/lib/edje_calc.c 2009-08-14 17:19:42 UTC (rev 41771) > @@ -65,7 +65,7 @@ > return ep->default_desc; > > if (!strcmp(name, "custom")) > - return rp->custom.description; > + return rp->custom ? rp->custom->description : NULL; > > if (!strcmp(name, "default")) > { > @@ -93,15 +93,33 @@ > void > _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, > double v1, const char *d2, double v2) > { > + Edje_Part_Description *epd1; > + Edje_Part_Description *epd2; > + > if (!d1) d1 = "default"; > if (!d2) d2 = "default"; > > - ep->param1.description = _edje_part_description_find(ed, ep, d1, v1); > - if (!ep->param1.description) > - ep->param1.description = ep->part->default_desc; /* never NULL */ > + epd1 = _edje_part_description_find(ed, ep, d1, v1); > + if (!epd1) > + epd1 = ep->part->default_desc; /* never NULL */ > > - ep->param2.description = _edje_part_description_find(ed, ep, d2, v2); > + epd2 = _edje_part_description_find(ed, ep, d2, v2); > > + if (epd2 != NULL && epd1 != epd2) > + { > + if (!ep->param2) > + ep->param2 = eina_mempool_malloc(_edje_real_part_state_mp, sizeof > (Edje_Real_Part_State)); > + } > + else > + if (ep->param2) > + { > + eina_mempool_free(_edje_real_part_state_mp, ep->param2); > + ep->param2 = NULL; > + } > + > + ep->param1.description = epd1; > + ep->chosen_description = epd1; > + > ep->param1.rel1_to_x = ep->param1.rel1_to_y = NULL; > ep->param1.rel2_to_x = ep->param1.rel2_to_y = NULL; > > @@ -114,26 +132,29 @@ > if (ep->param1.description->rel2.id_y >= 0) > ep->param1.rel2_to_y = > ed->table_parts[ep->param1.description->rel2.id_y % ed->table_parts_size]; > > - ep->param2.rel1_to_x = ep->param2.rel1_to_y = NULL; > - ep->param2.rel2_to_x = ep->param2.rel2_to_y = NULL; > + if (ep->param2) > + { > + ep->param2->description = epd2; > > - if (ep->param2.description) > - { > - if (ep->param2.description->rel1.id_x >= 0) > - ep->param2.rel1_to_x = > ed->table_parts[ep->param2.description->rel1.id_x % ed->table_parts_size]; > - if (ep->param2.description->rel1.id_y >= 0) > - ep->param2.rel1_to_y = > ed->table_parts[ep->param2.description->rel1.id_y % ed->table_parts_size]; > - if (ep->param2.description->rel2.id_x >= 0) > - ep->param2.rel2_to_x = > ed->table_parts[ep->param2.description->rel2.id_x % ed->table_parts_size]; > - if (ep->param2.description->rel2.id_y >= 0) > - ep->param2.rel2_to_y = > ed->table_parts[ep->param2.description->rel2.id_y % ed->table_parts_size]; > + ep->param2->rel1_to_x = ep->param2->rel1_to_y = NULL; > + ep->param2->rel2_to_x = ep->param2->rel2_to_y = NULL; > + > + if (ep->param2->description) > + { > + if (ep->param2->description->rel1.id_x >= 0) > + ep->param2->rel1_to_x = > ed->table_parts[ep->param2->description->rel1.id_x % ed->table_parts_size]; > + if (ep->param2->description->rel1.id_y >= 0) > + ep->param2->rel1_to_y = > ed->table_parts[ep->param2->description->rel1.id_y % ed->table_parts_size]; > + if (ep->param2->description->rel2.id_x >= 0) > + ep->param2->rel2_to_x = > ed->table_parts[ep->param2->description->rel2.id_x % ed->table_parts_size]; > + if (ep->param2->description->rel2.id_y >= 0) > + ep->param2->rel2_to_y = > ed->table_parts[ep->param2->description->rel2.id_y % ed->table_parts_size]; > + } > + > + if (ep->description_pos != 0.0) > + ep->chosen_description = epd2; > } > > - if (ep->description_pos == 0.0) > - ep->chosen_description = ep->param1.description; > - else > - ep->chosen_description = ep->param2.description; > - > ed->dirty = 1; > #ifdef EDJE_CALC_CACHE > ep->invalidate = 1; > @@ -1444,23 +1465,27 @@ > else > { > image_count = 2; > - if (ep->param2.description) > - image_count += > eina_list_count(ep->param2.description->image.tween_list); > + if (ep->param2) > + image_count += > eina_list_count(ep->param2->description->image.tween_list); > image_num = (pos * ((double)image_count - 0.5)); > if (image_num > (image_count - 1)) > image_num = image_count - 1; > if (image_num == 0) > image_id = ep->param1.description->image.id; > - else if (image_num == (image_count - 1)) > - image_id = ep->param2.description->image.id; > else > - { > - Edje_Part_Image_Id *imid; > + if (ep->param2) > + { > + if (image_num == (image_count - 1)) > + image_id = ep->param2->description->image.id; > + else > + { > + Edje_Part_Image_Id *imid; > > - imid = eina_list_nth(ep->param2.description->image.tween_list, > - image_num - 1); > - if (imid) image_id = imid->id; > - } > + imid = > eina_list_nth(ep->param2->description->image.tween_list, > + image_num - 1); > + if (imid) image_id = imid->id; > + } > + } > if (image_id < 0) > { > printf("EDJE ERROR: part \"%s\" has description, " > @@ -1525,6 +1550,7 @@ > Edje_Part_Description *chosen_desc; > Edje_Real_Part *confine_to = NULL; > double pos = 0.0; > + Edje_Calc_Params lp3; > > if ((ep->calculated & FLAG_XY) == FLAG_XY) > { > @@ -1559,6 +1585,11 @@ > #endif > return; > } > +#ifdef EDJE_CALC_CACHE > + if (ep->state == ed->state) > + return ; > +#endif > + > if (flags & FLAG_X) > { > ep->calculating |= flags & FLAG_X; > @@ -1577,20 +1608,23 @@ > state1 = ep->param1.rel2_to_x->state; > #endif > } > - if (ep->param2.rel1_to_x) > + if (ep->param2) > { > - _edje_part_recalc(ed, ep->param2.rel1_to_x, FLAG_X); > + if (ep->param2->rel1_to_x) > + { > + _edje_part_recalc(ed, ep->param2->rel1_to_x, FLAG_X); > #ifdef EDJE_CALC_CACHE > - state2 = ep->param2.rel1_to_x->state; > + state2 = ep->param2->rel1_to_x->state; > #endif > - } > - if (ep->param2.rel2_to_x) > - { > - _edje_part_recalc(ed, ep->param2.rel2_to_x, FLAG_X); > + } > + if (ep->param2->rel2_to_x) > + { > + _edje_part_recalc(ed, ep->param2->rel2_to_x, FLAG_X); > #ifdef EDJE_CALC_CACHE > - if (state2 < ep->param2.rel2_to_x->state) > - state2 = ep->param2.rel2_to_x->state; > + if (state2 < ep->param2->rel2_to_x->state) > + state2 = ep->param2->rel2_to_x->state; > #endif > + } > } > } > if (flags & FLAG_Y) > @@ -1612,21 +1646,24 @@ > state1 = ep->param1.rel2_to_y->state; > #endif > } > - if (ep->param2.rel1_to_y) > + if (ep->param2) > { > - _edje_part_recalc(ed, ep->param2.rel1_to_y, FLAG_Y); > + if (ep->param2->rel1_to_y) > + { > + _edje_part_recalc(ed, ep->param2->rel1_to_y, FLAG_Y); > #ifdef EDJE_CALC_CACHE > - if (state2 < ep->param2.rel1_to_y->state) > - state2 = ep->param2.rel1_to_y->state; > + if (state2 < ep->param2->rel1_to_y->state) > + state2 = ep->param2->rel1_to_y->state; > #endif > - } > - if (ep->param2.rel2_to_y) > - { > - _edje_part_recalc(ed, ep->param2.rel2_to_y, FLAG_Y); > + } > + if (ep->param2->rel2_to_y) > + { > + _edje_part_recalc(ed, ep->param2->rel2_to_y, FLAG_Y); > #ifdef EDJE_CALC_CACHE > - if (state2 < ep->param2.rel2_to_y->state) > - state2 = ep->param2.rel2_to_y->state; > + if (state2 < ep->param2->rel2_to_y->state) > + state2 = ep->param2->rel2_to_y->state; > #endif > + } > } > } > if (ep->drag && ep->drag->confine_to) > @@ -1652,7 +1689,7 @@ > #ifndef EDJE_CALC_CACHE > p1 = &lp1; > #else > - p1 = ep->param2.description ? &ep->param1.p : &ep->p; > + p1 = &ep->param1.p; > #endif > > if (ep->param1.description) > @@ -1675,33 +1712,32 @@ > #endif > } > } > - if (ep->param2.description) > + if (ep->param2 && ep->description_pos != 0.0) > { > int beginning_pos, part_type; > Edje_Calc_Params *p2, *p3; > + > + p3 = &lp3; > + > #ifndef EDJE_CALC_CACHE > - Edje_Calc_Params lp3; > - > p2 = &lp2; > - p3 = &lp3; > #else > - p2 = &ep->param2.p; > - p3 = &ep->p; > + p2 = &ep->param2->p; > > if (ed->all_part_change || > ep->invalidate || > - state2 >= ep->param2.state || > - statec >= ep->param2.state || > + state2 >= ep->param2->state || > + statec >= ep->param2->state || > ((ep->part->type == EDJE_PART_TYPE_TEXT || ep->part->type == > EDJE_PART_TYPE_TEXTBLOCK) && ed->text_part_change)) > #endif > { > - _edje_part_recalc_single(ed, ep, ep->param2.description, > chosen_desc, > - ep->param2.rel1_to_x, > ep->param2.rel1_to_y, ep->param2.rel2_to_x, ep->param2.rel2_to_y, > + _edje_part_recalc_single(ed, ep, ep->param2->description, > chosen_desc, > + ep->param2->rel1_to_x, > ep->param2->rel1_to_y, ep->param2->rel2_to_x, ep->param2->rel2_to_y, > confine_to, > p2, > flags); > #ifdef EDJE_CALC_CACHE > - ep->param2.state = ed->state; > + ep->param2->state = ed->state; > #endif > } > > @@ -1789,21 +1825,12 @@ > } > > pf = p3; > -#ifdef EDJE_CALC_CACHE > - ep->state = ed->state; > -#endif > } > else > { > pf = p1; > -#ifdef EDJE_CALC_CACHE > - ep->state = ep->param1.state; > -#endif > } > > -#ifdef EDJE_CALC_CACHE > - ep->invalidate = 0; > -#endif > ep->req = pf->req; > > if (ep->drag && ep->drag->need_reset) > @@ -1912,4 +1939,13 @@ > > ep->calculated |= flags; > ep->calculating = FLAG_NONE; > + > +#ifdef EDJE_CALC_CACHE > + if (ep->calculated == FLAG_XY) > + { > + ep->state = ed->state; > + ep->invalidate = 0; > + } > +#endif > + > } > > Modified: trunk/edje/src/lib/edje_edit.c > =================================================================== > --- trunk/edje/src/lib/edje_edit.c 2009-08-14 17:17:01 UTC (rev 41770) > +++ trunk/edje/src/lib/edje_edit.c 2009-08-14 17:19:42 UTC (rev 41771) > @@ -205,11 +205,15 @@ > if (rp->text.cache.in_str) eina_stringshare_del(rp->text.cache.in_str); > if (rp->text.cache.out_str) eina_stringshare_del(rp->text.cache.out_str); > > - if (rp->custom.description) > - _edje_collection_free_part_description_free(rp->custom.description, 0); > + if (rp->custom) > + _edje_collection_free_part_description_free(rp->custom->description, 0); > > + free(rp->drag); > + eina_mempool_free(_edje_real_part_state_mp, rp->param2); > + eina_mempool_free(_edje_real_part_state_mp, rp->custom); > + > _edje_unref(rp->edje); > - free(rp); > + eina_mempool_free(_edje_real_part_mp, rp); > } > > static unsigned char > @@ -1603,22 +1607,29 @@ > if (real->param1.rel2_to_x == rp) real->param1.rel2_to_x = NULL; > if (real->param1.rel2_to_y == rp) real->param1.rel2_to_y = NULL; > > - if (real->param2.rel1_to_x == rp) real->param2.rel1_to_x = NULL; > - if (real->param2.rel1_to_y == rp) real->param2.rel1_to_y = NULL; > - if (real->param2.rel2_to_x == rp) real->param2.rel2_to_x = NULL; > - if (real->param2.rel2_to_y == rp) real->param2.rel2_to_y = NULL; > + if (real->param2) > + { > + if (real->param2->rel1_to_x == rp) real->param2->rel1_to_x = NULL; > + if (real->param2->rel1_to_y == rp) real->param2->rel1_to_y = NULL; > + if (real->param2->rel2_to_x == rp) real->param2->rel2_to_x = NULL; > + if (real->param2->rel2_to_y == rp) real->param2->rel2_to_y = NULL; > + } > > - if (real->custom.rel1_to_x == rp) real->custom.rel1_to_x = NULL; > - if (real->custom.rel1_to_y == rp) real->custom.rel1_to_y = NULL; > - if (real->custom.rel2_to_x == rp) real->custom.rel2_to_x = NULL; > - if (real->custom.rel2_to_y == rp) real->custom.rel2_to_y = NULL; > + if (real->custom) > + { > + if (real->custom->rel1_to_x == rp) real->custom->rel1_to_x = NULL; > + if (real->custom->rel1_to_y == rp) real->custom->rel1_to_y = NULL; > + if (real->custom->rel2_to_x == rp) real->custom->rel2_to_x = NULL; > + if (real->custom->rel2_to_y == rp) real->custom->rel2_to_y = NULL; > + } > > if (real->clip_to == rp) > { > evas_object_clip_set(real->object, ed->clipper); > real->clip_to = NULL; > } > - //TODO confine ?? > + if (real->drag && real->drag->confine_to == rp) > + real->drag->confine_to = NULL; > } > > /* Unlink all the parts and descriptions that refer to id */ > > Modified: trunk/edje/src/lib/edje_embryo.c > =================================================================== > --- trunk/edje/src/lib/edje_embryo.c 2009-08-14 17:17:01 UTC (rev 41770) > +++ trunk/edje/src/lib/edje_embryo.c 2009-08-14 17:19:42 UTC (rev 41771) > @@ -1548,7 +1548,7 @@ > return 0; > > /* check whether this part already has a "custom" state */ > - if (rp->custom.description) > + if (rp->custom) > return 0; > > GETSTR(name, params[2]); > @@ -1564,6 +1564,13 @@ > if (!(d = calloc(1, sizeof(Edje_Part_Description)))) > return 0; > > + rp->custom = eina_mempool_malloc(_edje_real_part_state_mp, sizeof > (Edje_Real_Part_State)); > + if (!rp->custom) > + { > + free(d); > + return 0; > + } > + > *d = *parent; > > d->state.name = (char *)eina_stringshare_add("custom"); > @@ -1579,6 +1586,8 @@ > Edje_Part_Image_Id *iid_new; > > iid_new = calloc(1, sizeof(Edje_Part_Image_Id)); > + if (!iid_new) continue; > + > iid_new->id = iid->id; > > d->image.tween_list = eina_list_append(d->image.tween_list, iid_new); > @@ -1592,7 +1601,7 @@ > d->text.style = DUP(d->text.style); > #undef DUP > > - rp->custom.description = d; > + rp->custom->description = d; > > return 0; > } > @@ -1616,7 +1625,7 @@ > return 0; > > /* check whether this part has a "custom" state */ > - if (!rp->custom.description) > + if (!rp->custom) > return 0; > > switch (params[2]) > @@ -1624,90 +1633,90 @@ > case EDJE_STATE_PARAM_ALIGNMENT: > CHKPARAM(4); > > - GETFLOAT(rp->custom.description->align.x, params[3]); > - GETFLOAT(rp->custom.description->align.y, params[4]); > + GETFLOAT(rp->custom->description->align.x, params[3]); > + GETFLOAT(rp->custom->description->align.y, params[4]); > > break; > case EDJE_STATE_PARAM_MIN: > CHKPARAM(4); > > - GETINT(rp->custom.description->min.w, params[3]); > - GETINT(rp->custom.description->min.h, params[4]); > + GETINT(rp->custom->description->min.w, params[3]); > + GETINT(rp->custom->description->min.h, params[4]); > > break; > case EDJE_STATE_PARAM_MAX: > CHKPARAM(4); > > - GETINT(rp->custom.description->max.w, params[3]); > - GETINT(rp->custom.description->max.h, params[4]); > + GETINT(rp->custom->description->max.w, params[3]); > + GETINT(rp->custom->description->max.h, params[4]); > > break; > case EDJE_STATE_PARAM_STEP: > CHKPARAM(4); > > - GETINT(rp->custom.description->step.x, params[3]); > - GETINT(rp->custom.description->step.y, params[4]); > + GETINT(rp->custom->description->step.x, params[3]); > + GETINT(rp->custom->description->step.y, params[4]); > > break; > case EDJE_STATE_PARAM_ASPECT: > CHKPARAM(4); > > - GETFLOAT(rp->custom.description->aspect.min, params[3]); > - GETFLOAT(rp->custom.description->aspect.max, params[4]); > + GETFLOAT(rp->custom->description->aspect.min, params[3]); > + GETFLOAT(rp->custom->description->aspect.max, params[4]); > > break; > case EDJE_STATE_PARAM_ASPECT_PREF: > CHKPARAM(3); > > - GETINT(rp->custom.description->aspect.prefer, params[3]); > + GETINT(rp->custom->description->aspect.prefer, params[3]); > > break; > case EDJE_STATE_PARAM_COLOR: > CHKPARAM(6); > > - GETINT(rp->custom.description->color.r, params[3]); > - GETINT(rp->custom.description->color.g, params[4]); > - GETINT(rp->custom.description->color.b, params[5]); > - GETINT(rp->custom.description->color.a, params[6]); > + GETINT(rp->custom->description->color.r, params[3]); > + GETINT(rp->custom->description->color.g, params[4]); > + GETINT(rp->custom->description->color.b, params[5]); > + GETINT(rp->custom->description->color.a, params[6]); > > break; > case EDJE_STATE_PARAM_COLOR2: > CHKPARAM(6); > > - GETINT(rp->custom.description->color2.r, params[3]); > - GETINT(rp->custom.description->color2.g, params[4]); > - GETINT(rp->custom.description->color2.b, params[5]); > - GETINT(rp->custom.description->color2.a, params[6]); > + GETINT(rp->custom->description->color2.r, params[3]); > + GETINT(rp->custom->description->color2.g, params[4]); > + GETINT(rp->custom->description->color2.b, params[5]); > + GETINT(rp->custom->description->color2.a, params[6]); > > break; > case EDJE_STATE_PARAM_COLOR3: > CHKPARAM(6); > > - GETINT(rp->custom.description->color3.r, params[3]); > - GETINT(rp->custom.description->color3.g, params[4]); > - GETINT(rp->custom.description->color3.b, params[5]); > - GETINT(rp->custom.description->color3.a, params[6]); > + GETINT(rp->custom->description->color3.r, params[3]); > + GETINT(rp->custom->description->color3.g, params[4]); > + GETINT(rp->custom->description->color3.b, params[5]); > + GETINT(rp->custom->description->color3.a, params[6]); > > break; > case EDJE_STATE_PARAM_COLOR_CLASS: > CHKPARAM(3); > > GETSTR(s, params[3]); > - GETSTREVAS(s, rp->custom.description->color_class); > + GETSTREVAS(s, rp->custom->description->color_class); > > break; > case EDJE_STATE_PARAM_REL1: > CHKPARAM(4); > > - GETFLOAT(rp->custom.description->rel1.relative_x, params[3]); > - GETFLOAT(rp->custom.description->rel1.relative_y, params[4]); > + GETFLOAT(rp->custom->description->rel1.relative_x, params[3]); > + GETFLOAT(rp->custom->description->rel1.relative_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL1_TO: > CHKPARAM(4); > > - GETINT(rp->custom.description->rel1.id_x, params[3]); > - GETINT(rp->custom.description->rel1.id_y, params[4]); > + GETINT(rp->custom->description->rel1.id_x, params[3]); > + GETINT(rp->custom->description->rel1.id_y, params[4]); > > if (rp->param1.description->rel1.id_x >= 0) > rp->param1.rel1_to_x = > ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size]; > @@ -1718,22 +1727,22 @@ > case EDJE_STATE_PARAM_REL1_OFFSET: > CHKPARAM(4); > > - GETINT(rp->custom.description->rel1.offset_x, params[3]); > - GETINT(rp->custom.description->rel1.offset_y, params[4]); > + GETINT(rp->custom->description->rel1.offset_x, params[3]); > + GETINT(rp->custom->description->rel1.offset_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL2: > CHKPARAM(4); > > - GETFLOAT(rp->custom.description->rel2.relative_x, params[3]); > - GETFLOAT(rp->custom.description->rel2.relative_y, params[4]); > + GETFLOAT(rp->custom->description->rel2.relative_x, params[3]); > + GETFLOAT(rp->custom->description->rel2.relative_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL2_TO: > CHKPARAM(4); > > - GETINT(rp->custom.description->rel2.id_x, params[3]); > - GETINT(rp->custom.description->rel2.id_y, params[4]); > + GETINT(rp->custom->description->rel2.id_x, params[3]); > + GETINT(rp->custom->description->rel2.id_y, params[4]); > > if (rp->param1.description->rel2.id_x >= 0) > rp->param1.rel2_to_x = > ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size]; > @@ -1744,52 +1753,52 @@ > case EDJE_STATE_PARAM_REL2_OFFSET: > CHKPARAM(4); > > - GETINT(rp->custom.description->rel2.offset_x, params[3]); > - GETINT(rp->custom.description->rel2.offset_y, params[4]); > + GETINT(rp->custom->description->rel2.offset_x, params[3]); > + GETINT(rp->custom->description->rel2.offset_y, params[4]); > > break; > case EDJE_STATE_PARAM_IMAGE: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(3); > > - GETINT(rp->custom.description->image.id, params[3]); > + GETINT(rp->custom->description->image.id, params[3]); > > break; > case EDJE_STATE_PARAM_BORDER: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(6); > > - GETINT(rp->custom.description->border.l, params[3]); > - GETINT(rp->custom.description->border.r, params[4]); > - GETINT(rp->custom.description->border.t, params[5]); > - GETINT(rp->custom.description->border.b, params[6]); > + GETINT(rp->custom->description->border.l, params[3]); > + GETINT(rp->custom->description->border.r, params[4]); > + GETINT(rp->custom->description->border.t, params[5]); > + GETINT(rp->custom->description->border.b, params[6]); > > break; > case EDJE_STATE_PARAM_FILL_SMOOTH: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(3); > > - GETINT(rp->custom.description->fill.smooth, params[3]); > + GETINT(rp->custom->description->fill.smooth, params[3]); > > break; > case EDJE_STATE_PARAM_FILL_POS: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(6); > > - GETFLOAT(rp->custom.description->fill.pos_rel_x, params[3]); > - GETFLOAT(rp->custom.description->fill.pos_rel_y, params[4]); > - GETINT(rp->custom.description->fill.pos_abs_x, params[5]); > - GETINT(rp->custom.description->fill.pos_abs_y, params[6]); > + GETFLOAT(rp->custom->description->fill.pos_rel_x, params[3]); > + GETFLOAT(rp->custom->description->fill.pos_rel_y, params[4]); > + GETINT(rp->custom->description->fill.pos_abs_x, params[5]); > + GETINT(rp->custom->description->fill.pos_abs_y, params[6]); > > break; > case EDJE_STATE_PARAM_FILL_SIZE: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(6); > > - GETFLOAT(rp->custom.description->fill.rel_x, params[3]); > - GETFLOAT(rp->custom.description->fill.rel_y, params[4]); > - GETINT(rp->custom.description->fill.abs_x, params[5]); > - GETINT(rp->custom.description->fill.abs_y, params[6]); > + GETFLOAT(rp->custom->description->fill.rel_x, params[3]); > + GETFLOAT(rp->custom->description->fill.rel_y, params[4]); > + GETINT(rp->custom->description->fill.abs_x, params[5]); > + GETINT(rp->custom->description->fill.abs_y, params[6]); > > break; > case EDJE_STATE_PARAM_TEXT: > @@ -1799,7 +1808,7 @@ > CHKPARAM(3); > > GETSTR(s, params[3]); > - GETSTREVAS(s, rp->custom.description->text.text); > + GETSTREVAS(s, rp->custom->description->text.text); > > break; > case EDJE_STATE_PARAM_TEXT_CLASS: > @@ -1809,7 +1818,7 @@ > CHKPARAM(3); > > GETSTR(s, params[3]); > - GETSTREVAS(s, rp->custom.description->text.text_class); > + GETSTREVAS(s, rp->custom->description->text.text_class); > > break; > case EDJE_STATE_PARAM_TEXT_FONT: > @@ -1817,7 +1826,7 @@ > CHKPARAM(3); > > GETSTR(s, params[3]); > - GETSTREVAS(s, rp->custom.description->text.font); > + GETSTREVAS(s, rp->custom->description->text.font); > > break; > case EDJE_STATE_PARAM_TEXT_STYLE: > @@ -1825,22 +1834,22 @@ > CHKPARAM(3); > > GETSTR(s, params[3]); > - GETSTREVAS(s, rp->custom.description->text.style); > + GETSTREVAS(s, rp->custom->description->text.style); > > break; > case EDJE_STATE_PARAM_TEXT_SIZE: > if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; > CHKPARAM(3); > > - GETINT(rp->custom.description->text.size, params[3]); > + GETINT(rp->custom->description->text.size, params[3]); > > break; > case EDJE_STATE_PARAM_TEXT_FIT: > if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; > CHKPARAM(4); > > - GETINT(rp->custom.description->text.fit_x, params[3]); > - GETINT(rp->custom.description->text.fit_y, params[4]); > + GETINT(rp->custom->description->text.fit_x, params[3]); > + GETINT(rp->custom->description->text.fit_y, params[4]); > > break; > case EDJE_STATE_PARAM_TEXT_MIN: > @@ -1849,8 +1858,8 @@ > return 0; > CHKPARAM(4); > > - GETINT(rp->custom.description->text.min_x, params[3]); > - GETINT(rp->custom.description->text.min_y, params[4]); > + GETINT(rp->custom->description->text.min_x, params[3]); > + GETINT(rp->custom->description->text.min_y, params[4]); > > break; > case EDJE_STATE_PARAM_TEXT_MAX: > @@ -1859,22 +1868,22 @@ > return 0; > CHKPARAM(4); > > - GETINT(rp->custom.description->text.max_x, params[3]); > - GETINT(rp->custom.description->text.max_y, params[4]); > + GETINT(rp->custom->description->text.max_x, params[3]); > + GETINT(rp->custom->description->text.max_y, params[4]); > > break; > case EDJE_STATE_PARAM_TEXT_ALIGN: > if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; > CHKPARAM(4); > > - GETFLOAT(rp->custom.description->text.align.x, params[3]); > - GETFLOAT(rp->custom.description->text.align.y, params[4]); > + GETFLOAT(rp->custom->description->text.align.x, params[3]); > + GETFLOAT(rp->custom->description->text.align.y, params[4]); > > break; > case EDJE_STATE_PARAM_VISIBLE: > CHKPARAM(3); > > - GETINT(rp->custom.description->visible, params[3]); > + GETINT(rp->custom->description->visible, params[3]); > > break; > default: > @@ -1907,7 +1916,7 @@ > return 0; > > /* check whether this part has a "custom" state */ > - if (!rp->custom.description) > + if (!rp->custom) > return 0; > > switch (params[2]) > @@ -1915,162 +1924,162 @@ > case EDJE_STATE_PARAM_ALIGNMENT: > CHKPARAM(4); > > - SETFLOAT(rp->custom.description->align.x, params[3]); > - SETFLOAT(rp->custom.description->align.y, params[4]); > + SETFLOAT(rp->custom->description->align.x, params[3]); > + SETFLOAT(rp->custom->description->align.y, params[4]); > > break; > case EDJE_STATE_PARAM_MIN: > CHKPARAM(4); > > - SETINT(rp->custom.description->min.w, params[3]); > - SETINT(rp->custom.description->min.h, params[4]); > + SETINT(rp->custom->description->min.w, params[3]); > + SETINT(rp->custom->description->min.h, params[4]); > > break; > case EDJE_STATE_PARAM_MAX: > CHKPARAM(4); > > - SETINT(rp->custom.description->max.w, params[3]); > - SETINT(rp->custom.description->max.h, params[4]); > + SETINT(rp->custom->description->max.w, params[3]); > + SETINT(rp->custom->description->max.h, params[4]); > > break; > case EDJE_STATE_PARAM_STEP: > CHKPARAM(4); > > - SETINT(rp->custom.description->step.x, params[3]); > - SETINT(rp->custom.description->step.y, params[4]); > + SETINT(rp->custom->description->step.x, params[3]); > + SETINT(rp->custom->description->step.y, params[4]); > > break; > case EDJE_STATE_PARAM_ASPECT: > CHKPARAM(4); > > - SETFLOAT(rp->custom.description->aspect.min, params[3]); > - SETFLOAT(rp->custom.description->aspect.max, params[4]); > + SETFLOAT(rp->custom->description->aspect.min, params[3]); > + SETFLOAT(rp->custom->description->aspect.max, params[4]); > > break; > case EDJE_STATE_PARAM_ASPECT_PREF: > CHKPARAM(3); > > - SETINT(rp->custom.description->aspect.prefer, params[3]); > + SETINT(rp->custom->description->aspect.prefer, params[3]); > > break; > case EDJE_STATE_PARAM_COLOR: > CHKPARAM(6); > > - SETINT(rp->custom.description->color.r, params[3]); > - SETINT(rp->custom.description->color.g, params[4]); > - SETINT(rp->custom.description->color.b, params[5]); > - SETINT(rp->custom.description->color.a, params[6]); > + SETINT(rp->custom->description->color.r, params[3]); > + SETINT(rp->custom->description->color.g, params[4]); > + SETINT(rp->custom->description->color.b, params[5]); > + SETINT(rp->custom->description->color.a, params[6]); > > break; > case EDJE_STATE_PARAM_COLOR2: > CHKPARAM(6); > > - SETINT(rp->custom.description->color2.r, params[3]); > - SETINT(rp->custom.description->color2.g, params[4]); > - SETINT(rp->custom.description->color2.b, params[5]); > - SETINT(rp->custom.description->color2.a, params[6]); > + SETINT(rp->custom->description->color2.r, params[3]); > + SETINT(rp->custom->description->color2.g, params[4]); > + SETINT(rp->custom->description->color2.b, params[5]); > + SETINT(rp->custom->description->color2.a, params[6]); > > break; > case EDJE_STATE_PARAM_COLOR3: > CHKPARAM(6); > > - SETINT(rp->custom.description->color3.r, params[3]); > - SETINT(rp->custom.description->color3.g, params[4]); > - SETINT(rp->custom.description->color3.b, params[5]); > - SETINT(rp->custom.description->color3.a, params[6]); > + SETINT(rp->custom->description->color3.r, params[3]); > + SETINT(rp->custom->description->color3.g, params[4]); > + SETINT(rp->custom->description->color3.b, params[5]); > + SETINT(rp->custom->description->color3.a, params[6]); > > break; > case EDJE_STATE_PARAM_COLOR_CLASS: > CHKPARAM(4); > > - s = rp->custom.description->color_class; > + s = rp->custom->description->color_class; > SETSTRALLOCATE(s); > > break; > case EDJE_STATE_PARAM_REL1: > CHKPARAM(4); > > - SETFLOAT(rp->custom.description->rel1.relative_x, params[3]); > - SETFLOAT(rp->custom.description->rel1.relative_y, params[4]); > + SETFLOAT(rp->custom->description->rel1.relative_x, params[3]); > + SETFLOAT(rp->custom->description->rel1.relative_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL1_TO: > CHKPARAM(4); > > - SETINT(rp->custom.description->rel1.id_x, params[3]); > - SETINT(rp->custom.description->rel1.id_y, params[4]); > + SETINT(rp->custom->description->rel1.id_x, params[3]); > + SETINT(rp->custom->description->rel1.id_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL1_OFFSET: > CHKPARAM(4); > > - SETINT(rp->custom.description->rel1.offset_x, params[3]); > - SETINT(rp->custom.description->rel1.offset_y, params[4]); > + SETINT(rp->custom->description->rel1.offset_x, params[3]); > + SETINT(rp->custom->description->rel1.offset_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL2: > CHKPARAM(4); > > - SETFLOAT(rp->custom.description->rel2.relative_x, params[3]); > - SETFLOAT(rp->custom.description->rel2.relative_y, params[4]); > + SETFLOAT(rp->custom->description->rel2.relative_x, params[3]); > + SETFLOAT(rp->custom->description->rel2.relative_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL2_TO: > CHKPARAM(4); > > - SETINT(rp->custom.description->rel2.id_x, params[3]); > - SETINT(rp->custom.description->rel2.id_y, params[4]); > + SETINT(rp->custom->description->rel2.id_x, params[3]); > + SETINT(rp->custom->description->rel2.id_y, params[4]); > > break; > case EDJE_STATE_PARAM_REL2_OFFSET: > CHKPARAM(4); > > - SETINT(rp->custom.description->rel2.offset_x, params[3]); > - SETINT(rp->custom.description->rel2.offset_y, params[4]); > + SETINT(rp->custom->description->rel2.offset_x, params[3]); > + SETINT(rp->custom->description->rel2.offset_y, params[4]); > > break; > case EDJE_STATE_PARAM_IMAGE: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(3); > > - SETINT(rp->custom.description->image.id, params[3]); > + SETINT(rp->custom->description->image.id, params[3]); > > break; > case EDJE_STATE_PARAM_BORDER: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(6); > > - SETINT(rp->custom.description->border.l, params[3]); > - SETINT(rp->custom.description->border.r, params[4]); > - SETINT(rp->custom.description->border.t, params[5]); > - SETINT(rp->custom.description->border.b, params[6]); > + SETINT(rp->custom->description->border.l, params[3]); > + SETINT(rp->custom->description->border.r, params[4]); > + SETINT(rp->custom->description->border.t, params[5]); > + SETINT(rp->custom->description->border.b, params[6]); > > break; > case EDJE_STATE_PARAM_FILL_SMOOTH: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(3); > > - SETINT(rp->custom.description->fill.smooth, params[3]); > + SETINT(rp->custom->description->fill.smooth, params[3]); > > break; > case EDJE_STATE_PARAM_FILL_POS: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(6); > > - SETFLOAT(rp->custom.description->fill.pos_rel_x, params[3]); > - SETFLOAT(rp->custom.description->fill.pos_rel_y, params[4]); > - SETINT(rp->custom.description->fill.pos_abs_x, params[5]); > - SETINT(rp->custom.description->fill.pos_abs_y, params[6]); > + SETFLOAT(rp->custom->description->fill.pos_rel_x, params[3]); > + SETFLOAT(rp->custom->description->fill.pos_rel_y, params[4]); > + SETINT(rp->custom->description->fill.pos_abs_x, params[5]); > + SETINT(rp->custom->description->fill.pos_abs_y, params[6]); > > break; > case EDJE_STATE_PARAM_FILL_SIZE: > if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; > CHKPARAM(6); > > - SETFLOAT(rp->custom.description->fill.rel_x, params[3]); > - SETFLOAT(rp->custom.description->fill.rel_y, params[4]); > - SETINT(rp->custom.description->fill.abs_x, params[5]); > - SETINT(rp->custom.description->fill.abs_y, params[6]); > + SETFLOAT(rp->custom->description->fill.rel_x, params[3]); > + SETFLOAT(rp->custom->description->fill.rel_y, params[4]); > + SETINT(rp->custom->description->fill.abs_x, params[5]); > + SETINT(rp->custom->description->fill.abs_y, params[6]); > > break; > case EDJE_STATE_PARAM_TEXT: > @@ -2079,7 +2088,7 @@ > return 0; > CHKPARAM(4); > > - s = rp->custom.description->text.text; > + s = rp->custom->description->text.text; > SETSTRALLOCATE(s); > > break; > @@ -2089,7 +2098,7 @@ > return 0; > CHKPARAM(4); > > - s = rp->custom.description->text.text_class; > + s = rp->custom->description->text.text_class; > SETSTRALLOCATE(s); > > break; > @@ -2097,7 +2106,7 @@ > if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; > CHKPARAM(4); > > - s = rp->custom.description->text.font; > + s = rp->custom->description->text.font; > SETSTRALLOCATE(s); > > break; > @@ -2105,7 +2114,7 @@ > if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0; > CHKPARAM(4); > > - s = rp->custom.description->text.style; > + s = rp->custom->description->text.style; > SETSTRALLOCATE(s); > > break; > @@ -2113,15 +2122,15 @@ > if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; > CHKPARAM(3); > > - SETINT(rp->custom.description->text.size, params[3]); > + SETINT(rp->custom->description->text.size, params[3]); > > break; > case EDJE_STATE_PARAM_TEXT_FIT: > if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; > CHKPARAM(4); > > - SETINT(rp->custom.description->text.fit_x, params[3]); > - SETINT(rp->custom.description->text.fit_y, params[4]); > + SETINT(rp->custom->description->text.fit_x, params[3]); > + SETINT(rp->custom->description->text.fit_y, params[4]); > > break; > case EDJE_STATE_PARAM_TEXT_MIN: > @@ -2130,8 +2139,8 @@ > return 0; > CHKPARAM(4); > > - SETINT(rp->custom.description->text.min_x, params[3]); > - SETINT(rp->custom.description->text.min_y, params[4]); > + SETINT(rp->custom->description->text.min_x, params[3]); > + SETINT(rp->custom->description->text.min_y, params[4]); > > break; > case EDJE_STATE_PARAM_TEXT_MAX: > @@ -2140,22 +2149,22 @@ > return 0; > CHKPARAM(4); > > - SETINT(rp->custom.description->text.max_x, params[3]); > - SETINT(rp->custom.description->text.max_y, params[4]); > + SETINT(rp->custom->description->text.max_x, params[3]); > + SETINT(rp->custom->description->text.max_y, params[4]); > > break; > case EDJE_STATE_PARAM_TEXT_ALIGN: > if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; > CHKPARAM(4); > > - SETFLOAT(rp->custom.description->text.align.x, params[3]); > - SETFLOAT(rp->custom.description->text.align.y, params[4]); > + SETFLOAT(rp->custom->description->text.align.x, params[3]); > + SETFLOAT(rp->custom->description->text.align.y, params[4]); > > break; > case EDJE_STATE_PARAM_VISIBLE: > CHKPARAM(3); > > - SETINT(rp->custom.description->visible, params[3]); > + SETINT(rp->custom->description->visible, params[3]); > > break; > default: > > Modified: trunk/edje/src/lib/edje_load.c > =================================================================== > --- trunk/edje/src/lib/edje_load.c 2009-08-14 17:17:01 UTC (rev 41770) > +++ trunk/edje/src/lib/edje_load.c 2009-08-14 17:19:42 UTC (rev 41771) > @@ -346,13 +346,15 @@ > Edje_Real_Part *rp; > > ep = eina_list_data_get(l); > - rp = calloc(1, sizeof(Edje_Real_Part)); > + rp = eina_mempool_malloc(_edje_real_part_mp, > sizeof(Edje_Real_Part)); > if (!rp) > { > ed->load_error = > EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; > return 0; > } > > + memset(rp, 0, sizeof (Edje_Real_Part)); > + > if ((ep->dragable.x != 0) || (ep->dragable.y != 0)) > { > rp->drag = calloc(1, sizeof (Edje_Real_Part_Drag)); > @@ -846,13 +848,17 @@ > if (rp->text.cache.in_str) > eina_stringshare_del(rp->text.cache.in_str); > if (rp->text.cache.out_str) > eina_stringshare_del(rp->text.cache.out_str); > > - if (rp->custom.description) > - > _edje_collection_free_part_description_free(rp->custom.description, > ed->file->free_strings); > + if (rp->custom) > + > _edje_collection_free_part_description_free(rp->custom->description, > ed->file->free_strings); > > + /* Cleanup optional part. */ > free(rp->drag); > > + eina_mempool_free(_edje_real_part_state_mp, rp->param2); > + eina_mempool_free(_edje_real_part_state_mp, rp->custom); > + > _edje_unref(rp->edje); > - free(rp); > + eina_mempool_free(_edje_real_part_mp, rp); > } > } > if ((ed->file) && (ed->collection)) > > Modified: trunk/edje/src/lib/edje_main.c > =================================================================== > --- trunk/edje/src/lib/edje_main.c 2009-08-14 17:17:01 UTC (rev 41770) > +++ trunk/edje/src/lib/edje_main.c 2009-08-14 17:19:42 UTC (rev 41771) > @@ -7,6 +7,8 @@ > #include "edje_private.h" > > static int initted = 0; > +Eina_Mempool *_edje_real_part_mp = NULL; > +Eina_Mempool *_edje_real_part_state_mp = NULL; > > /************************** API Routines **************************/ > > @@ -20,6 +22,8 @@ > initted++; > if (initted == 1) > { > + const char *choice; > + > eina_init(); > ecore_job_init(); > srand(time(NULL)); > @@ -28,9 +32,34 @@ > _edje_box_init(); > embryo_init(); > eet_init(); > + > + _edje_real_part_mp = eina_mempool_add("chained_mempool", > + "Edje_Real_Part", NULL, > + sizeof (Edje_Real_Part), 128); > + if (!_edje_real_part_mp) > + { > + EINA_ERROR_PERR("ERROR: Mempool for Edje_Real_Part cannot be > allocated.\n"); > + goto on_error; > + } > + > + _edje_real_part_state_mp = eina_mempool_add("chained_mempool", > + "Edje_Real_Part_State", NULL, > + sizeof (Edje_Real_Part_State), > 256); > + if (!_edje_real_part_state_mp) > + { > + EINA_ERROR_PERR("ERROR: Mempool for Edje_Real_Part_State cannot be > allocated.\n"); > + goto on_error; > + } > } > _edje_message_init(); > return initted; > + > + on_error: > + eina_mempool_del(_edje_real_part_state_mp); > + eina_mempool_del(_edje_real_part_mp); > + _edje_real_part_state_mp = NULL; > + _edje_real_part_mp = NULL; > + return 0; > } > > /** Shutdown the EDJE library. > @@ -55,6 +84,12 @@ > _edje_text_class_members_free(); > _edje_text_class_hash_free(); > _edje_box_shutdown(); > + > + eina_mempool_del(_edje_real_part_state_mp); > + eina_mempool_del(_edje_real_part_mp); > + _edje_real_part_state_mp = NULL; > + _edje_real_part_mp = NULL; > + > embryo_shutdown(); > ecore_job_shutdown(); > eet_shutdown(); > > Modified: trunk/edje/src/lib/edje_private.h > =================================================================== > --- trunk/edje/src/lib/edje_private.h 2009-08-14 17:17:01 UTC (rev 41770) > +++ trunk/edje/src/lib/edje_private.h 2009-08-14 17:19:42 UTC (rev 41771) > @@ -840,11 +840,11 @@ > > double description_pos; // 8 > Edje_Part_Description *chosen_description; // 4 > - Edje_Real_Part_State param1, param2, custom; // 60 // FIXME: custom > should be alloced on demand - 20-- > - // WITH EDJE_CALC_CACHE: 420 > + Edje_Real_Part_State param1; // 20 > + // WITH EDJE_CALC_CACHE: 140 > + Edje_Real_Part_State *param2, *custom; // 8 > > #ifdef EDJE_CALC_CACHE > - Edje_Calc_Params p; // 116 > int state; // 4 > #endif > > @@ -862,8 +862,8 @@ > #ifdef EDJE_CALC_CACHE > unsigned char invalidate : 1; > #endif > -}; // 298 > -// WITH EDJE_CALC_CACHE: 778 > +}; // 260 > +// WITH EDJE_CALC_CACHE: 400 > > struct _Edje_Running_Program > { > @@ -1101,6 +1101,9 @@ > extern int _edje_freeze_val; > extern int _edje_freeze_calc_count; > > +extern Eina_Mempool *_edje_real_part_mp; > +extern Eina_Mempool *_edje_real_part_state_mp; > + > void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos); > Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part > *rp, const char *name, double val); > void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char > *d1, double v1, const char *d2, double v2); > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel