forked from enlightenment/efl
edje recalc - move rare recalc code out of hot path
we rarely use tables in edje, so move it out of the hot path for intruction prefetch/cache. also for calc single - move things to sub funcs so things like mesh, light and so on code is always out of the hot path as much as possible. we probably can merge our 2 switch statements as well. this really just restructures the code to move stuff into sub functions which also does make the calc funcs look simpler and easier to read.
This commit is contained in:
parent
55b3e8e96d
commit
cfa8224140
|
@ -960,6 +960,46 @@ _edje_recalc(Edje *ed)
|
||||||
// ed->postponed = EINA_TRUE;
|
// ed->postponed = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
Eina_Bool
|
||||||
|
#else
|
||||||
|
void
|
||||||
|
#endif
|
||||||
|
_edje_recalc_table_parts(Edje *ed
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
, Eina_Bool need_reinit_state
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
unsigned short i;
|
||||||
|
Edje_Real_Part *ep;
|
||||||
|
|
||||||
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
|
{
|
||||||
|
ep = ed->table_parts[i];
|
||||||
|
ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
|
||||||
|
ep->calculating = FLAG_NONE;
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
if (need_reinit_state)
|
||||||
|
{
|
||||||
|
ep->state = 0;
|
||||||
|
ep->param1.state = 0;
|
||||||
|
if (ep->param2) ep->param2->state = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
|
{
|
||||||
|
ep = ed->table_parts[i];
|
||||||
|
if (ep->calculated != FLAG_XY) // FIXME: this is always true (see for above)
|
||||||
|
_edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
|
||||||
|
}
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
return need_reinit_state;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_edje_recalc_do(Edje *ed)
|
_edje_recalc_do(Edje *ed)
|
||||||
{
|
{
|
||||||
|
@ -986,31 +1026,16 @@ _edje_recalc_do(Edje *ed)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ed->table_parts_size; i++)
|
if (EINA_UNLIKELY(ed->table_parts_size > 0))
|
||||||
{
|
|
||||||
Edje_Real_Part *ep;
|
|
||||||
|
|
||||||
ep = ed->table_parts[i];
|
|
||||||
ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
|
|
||||||
ep->calculating = FLAG_NONE;
|
|
||||||
#ifdef EDJE_CALC_CACHE
|
#ifdef EDJE_CALC_CACHE
|
||||||
if (need_reinit_state)
|
need_reinit_state =
|
||||||
{
|
|
||||||
ep->state = 0;
|
|
||||||
ep->param1.state = 0;
|
|
||||||
if (ep->param2)
|
|
||||||
ep->param2->state = 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
_edje_recalc_table_parts(ed
|
||||||
for (i = 0; i < ed->table_parts_size; i++)
|
#ifdef EDJE_CALC_CACHE
|
||||||
{
|
, need_reinit_state
|
||||||
Edje_Real_Part *ep;
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
ep = ed->table_parts[i];
|
|
||||||
if (ep->calculated != FLAG_XY) // FIXME: this is always true (see for above)
|
|
||||||
_edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
|
|
||||||
}
|
|
||||||
if (!ed->calc_only) ed->recalc = EINA_FALSE;
|
if (!ed->calc_only) ed->recalc = EINA_FALSE;
|
||||||
#ifdef EDJE_CALC_CACHE
|
#ifdef EDJE_CALC_CACHE
|
||||||
ed->all_part_change = EINA_FALSE;
|
ed->all_part_change = EINA_FALSE;
|
||||||
|
@ -2690,6 +2715,220 @@ _edje_part_recalc_single_filter(Edje *ed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_table(Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description_Common *chosen_desc,
|
||||||
|
int *minw, int *minh)
|
||||||
|
{
|
||||||
|
Eina_Size2D lmin;
|
||||||
|
|
||||||
|
efl_canvas_group_need_recalculate_set(ep->object, 1);
|
||||||
|
efl_canvas_group_calculate(ep->object);
|
||||||
|
lmin = efl_gfx_hint_size_restricted_min_get(ep->object);
|
||||||
|
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h)
|
||||||
|
{
|
||||||
|
if (lmin.w > *minw) *minw = lmin.w;
|
||||||
|
}
|
||||||
|
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
|
||||||
|
{
|
||||||
|
if (lmin.h > *minh) *minh = lmin.h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_box(Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description_Common *chosen_desc,
|
||||||
|
int *minw, int *minh)
|
||||||
|
{
|
||||||
|
Eina_Size2D lmin;
|
||||||
|
|
||||||
|
efl_canvas_group_need_recalculate_set(ep->object, 1);
|
||||||
|
efl_canvas_group_calculate(ep->object);
|
||||||
|
lmin = efl_gfx_hint_size_restricted_min_get(ep->object);
|
||||||
|
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
|
||||||
|
{
|
||||||
|
if (lmin.w > *minw) *minw = lmin.w;
|
||||||
|
}
|
||||||
|
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
|
||||||
|
{
|
||||||
|
if (lmin.h > *minh) *minh = lmin.h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_image(Edje *ed, Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description_Common *chosen_desc,
|
||||||
|
FLOAT_T pos,
|
||||||
|
int *minw, int *minh, int *maxw, int *maxh)
|
||||||
|
{
|
||||||
|
Evas_Coord w, h;
|
||||||
|
|
||||||
|
/* We only need pos to find the right image that would be displayed */
|
||||||
|
/* Yes, if someone set aspect preference to SOURCE and also max,min
|
||||||
|
to SOURCE, it will be under efficient, but who cares at the
|
||||||
|
moment. */
|
||||||
|
_edje_real_part_image_set(ed, ep, NULL, pos);
|
||||||
|
evas_object_image_size_get(ep->object, &w, &h);
|
||||||
|
if (chosen_desc->min.limit)
|
||||||
|
{
|
||||||
|
if (w > *minw) *minw = w;
|
||||||
|
if (h > *minh) *minh = h;
|
||||||
|
}
|
||||||
|
if (chosen_desc->max.limit)
|
||||||
|
{
|
||||||
|
if ((*maxw <= 0) || (w < *maxw)) *maxw = w;
|
||||||
|
if ((*maxh <= 0) || (h < *maxh)) *maxh = h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_EPHYSICS
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_physics(Edje_Calc_Params *params,
|
||||||
|
Edje_Part_Description_Common *desc)
|
||||||
|
{
|
||||||
|
EINA_COW_CALC_PHYSICS_BEGIN(params, params_write)
|
||||||
|
{
|
||||||
|
params_write->mass = desc->physics.mass;
|
||||||
|
params_write->restitution = desc->physics.restitution;
|
||||||
|
params_write->friction = desc->physics.friction;
|
||||||
|
params_write->damping.linear = desc->physics.damping.linear;
|
||||||
|
params_write->damping.angular = desc->physics.damping.angular;
|
||||||
|
params_write->sleep.linear = desc->physics.sleep.linear;
|
||||||
|
params_write->sleep.angular = desc->physics.sleep.angular;
|
||||||
|
params_write->material = desc->physics.material;
|
||||||
|
params_write->density = desc->physics.density;
|
||||||
|
params_write->hardness = desc->physics.hardness;
|
||||||
|
params_write->ignore_part_pos = desc->physics.ignore_part_pos;
|
||||||
|
params_write->light_on = desc->physics.light_on;
|
||||||
|
params_write->mov_freedom.lin.x = desc->physics.mov_freedom.lin.x;
|
||||||
|
params_write->mov_freedom.lin.y = desc->physics.mov_freedom.lin.y;
|
||||||
|
params_write->mov_freedom.lin.z = desc->physics.mov_freedom.lin.z;
|
||||||
|
params_write->mov_freedom.ang.x = desc->physics.mov_freedom.ang.x;
|
||||||
|
params_write->mov_freedom.ang.y = desc->physics.mov_freedom.ang.y;
|
||||||
|
params_write->mov_freedom.ang.z = desc->physics.mov_freedom.ang.z;
|
||||||
|
params_write->backcull = desc->physics.backcull;
|
||||||
|
params_write->z = desc->physics.z;
|
||||||
|
params_write->depth = desc->physics.depth;
|
||||||
|
}
|
||||||
|
EINA_COW_CALC_PHYSICS_END(params, params_write);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_calc_single_fixed_info(Edje *ed, Edje_Real_Part *ep,
|
||||||
|
Eina_Bool fixedw, Eina_Bool fixedh)
|
||||||
|
{
|
||||||
|
INF("file %s, group %s has a non-fixed part '%s'. You should add "
|
||||||
|
"'fixed: %d %d'. But in order to optimize the edje calc, we "
|
||||||
|
"add it automatically.", ed->path, ed->group, ep->part->name,
|
||||||
|
fixedw, fixedh);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_calc_single_image0(Edje *ed, Edje_Real_Part *ep,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
Edje_Part_Description_Image *img_desc,
|
||||||
|
FLOAT_T pos)
|
||||||
|
{
|
||||||
|
Edje_Real_Part_Set *set;
|
||||||
|
|
||||||
|
_edje_real_part_image_set(ed, ep, &set, pos);
|
||||||
|
|
||||||
|
/* border */
|
||||||
|
_edje_calc_params_need_type_common(params);
|
||||||
|
params->type.common->spec.image.l = img_desc->image.border.l;
|
||||||
|
params->type.common->spec.image.r = img_desc->image.border.r;
|
||||||
|
params->type.common->spec.image.t = img_desc->image.border.t;
|
||||||
|
params->type.common->spec.image.b = img_desc->image.border.b;
|
||||||
|
|
||||||
|
params->type.common->spec.image.border_scale_by = img_desc->image.border.scale_by;
|
||||||
|
|
||||||
|
if (set && set->set)
|
||||||
|
{
|
||||||
|
#define SET_BORDER_DEFINED(Result, Value) Result = Value ? Value : Result;
|
||||||
|
SET_BORDER_DEFINED(params->type.common->spec.image.l, set->entry->border.l);
|
||||||
|
SET_BORDER_DEFINED(params->type.common->spec.image.r, set->entry->border.r);
|
||||||
|
SET_BORDER_DEFINED(params->type.common->spec.image.t, set->entry->border.t);
|
||||||
|
SET_BORDER_DEFINED(params->type.common->spec.image.b, set->entry->border.b);
|
||||||
|
|
||||||
|
params->type.common->spec.image.border_scale_by = NEQ(set->entry->border.scale_by, ZERO) ?
|
||||||
|
set->entry->border.scale_by : params->type.common->spec.image.border_scale_by;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_calc_single_text0(Edje_Calc_Params *params,
|
||||||
|
Edje_Part_Description_Text *text_desc,
|
||||||
|
Edje_Color_Class *cc)
|
||||||
|
{
|
||||||
|
_edje_calc_params_need_type_text(params);
|
||||||
|
/* text.align */
|
||||||
|
params->type.text->align.x = text_desc->text.align.x;
|
||||||
|
params->type.text->align.y = text_desc->text.align.y;
|
||||||
|
params->type.text->ellipsis = text_desc->text.ellipsis;
|
||||||
|
|
||||||
|
/* text colors */
|
||||||
|
if (cc)
|
||||||
|
{
|
||||||
|
params->type.text->color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8;
|
||||||
|
params->type.text->color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8;
|
||||||
|
params->type.text->color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8;
|
||||||
|
params->type.text->color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8;
|
||||||
|
params->type.text->color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8;
|
||||||
|
params->type.text->color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8;
|
||||||
|
params->type.text->color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8;
|
||||||
|
params->type.text->color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
params->type.text->color2.r = text_desc->common.color2.r;
|
||||||
|
params->type.text->color2.g = text_desc->common.color2.g;
|
||||||
|
params->type.text->color2.b = text_desc->common.color2.b;
|
||||||
|
params->type.text->color2.a = text_desc->common.color2.a;
|
||||||
|
params->type.text->color3.r = text_desc->text.color3.r;
|
||||||
|
params->type.text->color3.g = text_desc->text.color3.g;
|
||||||
|
params->type.text->color3.b = text_desc->text.color3.b;
|
||||||
|
params->type.text->color3.a = text_desc->text.color3.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_calc_single_light0(Edje_Calc_Params *params,
|
||||||
|
Edje_Part_Description_Light *light_desc)
|
||||||
|
{
|
||||||
|
_edje_calc_params_need_type_node(params);
|
||||||
|
params->type.node->data[0] = light_desc->light.orientation.data[0];
|
||||||
|
params->type.node->point.x = light_desc->light.position.point.x;
|
||||||
|
params->type.node->point.y = light_desc->light.position.point.y;
|
||||||
|
params->type.node->point.z = light_desc->light.position.point.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_calc_single_camera0(Edje_Calc_Params *params,
|
||||||
|
Edje_Part_Description_Camera *camera_desc)
|
||||||
|
{
|
||||||
|
_edje_calc_params_need_type_node(params);
|
||||||
|
params->type.node->data[0] = camera_desc->camera.orientation.data[0];
|
||||||
|
params->type.node->point.x = camera_desc->camera.position.point.x;
|
||||||
|
params->type.node->point.y = camera_desc->camera.position.point.y;
|
||||||
|
params->type.node->point.z = camera_desc->camera.position.point.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_calc_single_mesh0(Edje_Calc_Params *params,
|
||||||
|
Edje_Part_Description_Mesh_Node *mesh_desc)
|
||||||
|
{
|
||||||
|
_edje_calc_params_need_type_node(params);
|
||||||
|
params->type.node->frame = mesh_desc->mesh_node.mesh.frame;
|
||||||
|
params->type.node->data[0] = mesh_desc->mesh_node.orientation.data[0];
|
||||||
|
params->type.node->point.x = mesh_desc->mesh_node.position.point.x;
|
||||||
|
params->type.node->point.y = mesh_desc->mesh_node.position.point.y;
|
||||||
|
params->type.node->point.z = mesh_desc->mesh_node.position.point.z;
|
||||||
|
params->type.node->scale_3d.x = mesh_desc->mesh_node.scale_3d.x;
|
||||||
|
params->type.node->scale_3d.y = mesh_desc->mesh_node.scale_3d.y;
|
||||||
|
params->type.node->scale_3d.z = mesh_desc->mesh_node.scale_3d.z;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edje_part_recalc_single(Edje *ed,
|
_edje_part_recalc_single(Edje *ed,
|
||||||
Edje_Real_Part *ep,
|
Edje_Real_Part *ep,
|
||||||
|
@ -2739,7 +2978,6 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
chosen_desc->fixed.w = 1;
|
chosen_desc->fixed.w = 1;
|
||||||
fixedw = EINA_TRUE;
|
fixedw = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rel1_to_y == rel2_to_y) &&
|
if ((rel1_to_y == rel2_to_y) &&
|
||||||
(EQ(desc->rel1.relative_y, desc->rel2.relative_y)) &&
|
(EQ(desc->rel1.relative_y, desc->rel2.relative_y)) &&
|
||||||
(!chosen_desc->fixed.h))
|
(!chosen_desc->fixed.h))
|
||||||
|
@ -2748,19 +2986,13 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
fixedh = EINA_TRUE;
|
fixedh = EINA_TRUE;
|
||||||
}
|
}
|
||||||
if (fixedw || fixedh)
|
if (fixedw || fixedh)
|
||||||
{
|
_edje_part_calc_single_fixed_info(ed, ep, fixedw, fixedh);
|
||||||
INF("file %s, group %s has a non-fixed part '%s'. You should add "
|
|
||||||
"'fixed: %d %d'. But in order to optimize the edje calc, we "
|
|
||||||
"add it automatically.", ed->path, ed->group, ep->part->name,
|
|
||||||
fixedw, fixedh);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* colors */
|
/* colors */
|
||||||
if (ep->part->type != EDJE_PART_TYPE_SPACER)
|
if (ep->part->type != EDJE_PART_TYPE_SPACER)
|
||||||
{
|
{
|
||||||
if ((desc->color_class) && (*desc->color_class))
|
if ((desc->color_class) && (*desc->color_class))
|
||||||
cc = _edje_color_class_recursive_find(ed, desc->color_class);
|
cc = _edje_color_class_recursive_find(ed, desc->color_class);
|
||||||
|
|
||||||
if (cc)
|
if (cc)
|
||||||
{
|
{
|
||||||
params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8;
|
params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8;
|
||||||
|
@ -2799,79 +3031,16 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
params->ext->clip_to = clip_to;
|
params->ext->clip_to = clip_to;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set parameters, some are required for recalc_single_text[block] */
|
// set parameters, some are required for recalc_single_text[block]
|
||||||
switch (ep->part->type)
|
switch (ep->part->type)
|
||||||
{
|
{
|
||||||
case EDJE_PART_TYPE_IMAGE:
|
case EDJE_PART_TYPE_IMAGE:
|
||||||
{
|
_edje_part_calc_single_image0(ed, ep, params, (Edje_Part_Description_Image *)desc, pos);
|
||||||
Edje_Real_Part_Set *set;
|
|
||||||
Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image *)desc;
|
|
||||||
|
|
||||||
_edje_real_part_image_set(ed, ep, &set, pos);
|
|
||||||
|
|
||||||
/* border */
|
|
||||||
_edje_calc_params_need_type_common(params);
|
|
||||||
params->type.common->spec.image.l = img_desc->image.border.l;
|
|
||||||
params->type.common->spec.image.r = img_desc->image.border.r;
|
|
||||||
|
|
||||||
params->type.common->spec.image.t = img_desc->image.border.t;
|
|
||||||
params->type.common->spec.image.b = img_desc->image.border.b;
|
|
||||||
|
|
||||||
params->type.common->spec.image.border_scale_by = img_desc->image.border.scale_by;
|
|
||||||
|
|
||||||
if (set && set->set)
|
|
||||||
{
|
|
||||||
#define SET_BORDER_DEFINED(Result, Value) Result = Value ? Value : Result;
|
|
||||||
SET_BORDER_DEFINED(params->type.common->spec.image.l, set->entry->border.l);
|
|
||||||
SET_BORDER_DEFINED(params->type.common->spec.image.r, set->entry->border.r);
|
|
||||||
SET_BORDER_DEFINED(params->type.common->spec.image.t, set->entry->border.t);
|
|
||||||
SET_BORDER_DEFINED(params->type.common->spec.image.b, set->entry->border.b);
|
|
||||||
|
|
||||||
params->type.common->spec.image.border_scale_by = NEQ(set->entry->border.scale_by, ZERO) ?
|
|
||||||
set->entry->border.scale_by : params->type.common->spec.image.border_scale_by;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case EDJE_PART_TYPE_TEXT:
|
case EDJE_PART_TYPE_TEXT:
|
||||||
case EDJE_PART_TYPE_TEXTBLOCK:
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
||||||
{
|
_edje_part_calc_single_text0(params, (Edje_Part_Description_Text *)desc, cc);
|
||||||
Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text *)desc;
|
|
||||||
|
|
||||||
_edje_calc_params_need_type_text(params);
|
|
||||||
/* text.align */
|
|
||||||
params->type.text->align.x = text_desc->text.align.x;
|
|
||||||
params->type.text->align.y = text_desc->text.align.y;
|
|
||||||
params->type.text->ellipsis = text_desc->text.ellipsis;
|
|
||||||
|
|
||||||
/* text colors */
|
|
||||||
if (cc)
|
|
||||||
{
|
|
||||||
params->type.text->color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8;
|
|
||||||
params->type.text->color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8;
|
|
||||||
params->type.text->color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8;
|
|
||||||
params->type.text->color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8;
|
|
||||||
params->type.text->color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8;
|
|
||||||
params->type.text->color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8;
|
|
||||||
params->type.text->color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8;
|
|
||||||
params->type.text->color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
params->type.text->color2.r = text_desc->common.color2.r;
|
|
||||||
params->type.text->color2.g = text_desc->common.color2.g;
|
|
||||||
params->type.text->color2.b = text_desc->common.color2.b;
|
|
||||||
params->type.text->color2.a = text_desc->common.color2.a;
|
|
||||||
params->type.text->color3.r = text_desc->text.color3.r;
|
|
||||||
params->type.text->color3.g = text_desc->text.color3.g;
|
|
||||||
params->type.text->color3.b = text_desc->text.color3.b;
|
|
||||||
params->type.text->color3.a = text_desc->text.color3.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case EDJE_PART_TYPE_SPACER:
|
case EDJE_PART_TYPE_SPACER:
|
||||||
case EDJE_PART_TYPE_RECTANGLE:
|
case EDJE_PART_TYPE_RECTANGLE:
|
||||||
case EDJE_PART_TYPE_BOX:
|
case EDJE_PART_TYPE_BOX:
|
||||||
|
@ -2882,136 +3051,56 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
case EDJE_PART_TYPE_SNAPSHOT:
|
case EDJE_PART_TYPE_SNAPSHOT:
|
||||||
case EDJE_PART_TYPE_VECTOR:
|
case EDJE_PART_TYPE_VECTOR:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDJE_PART_TYPE_LIGHT:
|
case EDJE_PART_TYPE_LIGHT:
|
||||||
{
|
_edje_part_calc_single_light0(params, (Edje_Part_Description_Light *)desc);
|
||||||
Edje_Part_Description_Light *light_desc = (Edje_Part_Description_Light *)desc;
|
|
||||||
|
|
||||||
_edje_calc_params_need_type_node(params);
|
|
||||||
params->type.node->data[0] = light_desc->light.orientation.data[0];
|
|
||||||
params->type.node->point.x = light_desc->light.position.point.x;
|
|
||||||
params->type.node->point.y = light_desc->light.position.point.y;
|
|
||||||
params->type.node->point.z = light_desc->light.position.point.z;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case EDJE_PART_TYPE_CAMERA:
|
case EDJE_PART_TYPE_CAMERA:
|
||||||
{
|
_edje_part_calc_single_camera0(params, (Edje_Part_Description_Camera *)desc);
|
||||||
Edje_Part_Description_Camera *camera_desc = (Edje_Part_Description_Camera *)desc;
|
|
||||||
|
|
||||||
_edje_calc_params_need_type_node(params);
|
|
||||||
params->type.node->data[0] = camera_desc->camera.orientation.data[0];
|
|
||||||
params->type.node->point.x = camera_desc->camera.position.point.x;
|
|
||||||
params->type.node->point.y = camera_desc->camera.position.point.y;
|
|
||||||
params->type.node->point.z = camera_desc->camera.position.point.z;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case EDJE_PART_TYPE_MESH_NODE:
|
case EDJE_PART_TYPE_MESH_NODE:
|
||||||
{
|
_edje_part_calc_single_mesh0(params, (Edje_Part_Description_Mesh_Node *)desc);
|
||||||
Edje_Part_Description_Mesh_Node *mesh_desc = (Edje_Part_Description_Mesh_Node *)desc;
|
|
||||||
|
|
||||||
_edje_calc_params_need_type_node(params);
|
|
||||||
params->type.node->frame = mesh_desc->mesh_node.mesh.frame;
|
|
||||||
params->type.node->data[0] = mesh_desc->mesh_node.orientation.data[0];
|
|
||||||
params->type.node->point.x = mesh_desc->mesh_node.position.point.x;
|
|
||||||
params->type.node->point.y = mesh_desc->mesh_node.position.point.y;
|
|
||||||
params->type.node->point.z = mesh_desc->mesh_node.position.point.z;
|
|
||||||
params->type.node->scale_3d.x = mesh_desc->mesh_node.scale_3d.x;
|
|
||||||
params->type.node->scale_3d.y = mesh_desc->mesh_node.scale_3d.y;
|
|
||||||
params->type.node->scale_3d.z = mesh_desc->mesh_node.scale_3d.z;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case EDJE_PART_TYPE_GRADIENT:
|
case EDJE_PART_TYPE_GRADIENT:
|
||||||
/* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */
|
// FIXME: THIS ONE SHOULD NEVER BE TRIGGERED
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we have text that wants to make the min size the text size... */
|
// limit size if needed
|
||||||
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
switch (ep->part->type)
|
||||||
|
{
|
||||||
|
// if we have text that wants to make the min size the text size...
|
||||||
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
||||||
_edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
_edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
||||||
else if (ep->part->type == EDJE_PART_TYPE_TEXT)
|
break;
|
||||||
{
|
case EDJE_PART_TYPE_TEXT:
|
||||||
_edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
_edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text *)desc, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
||||||
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
||||||
}
|
break;
|
||||||
|
// or table/box containers that want to do the same
|
||||||
if ((ep->part->type == EDJE_PART_TYPE_TABLE) &&
|
case EDJE_PART_TYPE_TABLE:
|
||||||
(((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) ||
|
if (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) ||
|
||||||
(((Edje_Part_Description_Table *)chosen_desc)->table.min.v))))
|
(((Edje_Part_Description_Table *)chosen_desc)->table.min.v)))
|
||||||
{
|
_edje_part_recalc_single_table(ep, chosen_desc, &minw, &minh);
|
||||||
Eina_Size2D lmin;
|
break;
|
||||||
|
case EDJE_PART_TYPE_BOX:
|
||||||
efl_canvas_group_need_recalculate_set(ep->object, 1);
|
if ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
|
||||||
efl_canvas_group_calculate(ep->object);
|
(((Edje_Part_Description_Box *)chosen_desc)->box.min.v))
|
||||||
lmin = efl_gfx_hint_size_restricted_min_get(ep->object);
|
_edje_part_recalc_single_box(ep, chosen_desc, &minw, &minh);
|
||||||
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h)
|
break;
|
||||||
{
|
// or an image that also wants to do this
|
||||||
if (lmin.w > minw) minw = lmin.w;
|
case EDJE_PART_TYPE_IMAGE:
|
||||||
}
|
|
||||||
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
|
|
||||||
{
|
|
||||||
if (lmin.h > minh) minh = lmin.h;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((ep->part->type == EDJE_PART_TYPE_BOX) &&
|
|
||||||
((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
|
|
||||||
(((Edje_Part_Description_Box *)chosen_desc)->box.min.v)))
|
|
||||||
{
|
|
||||||
Eina_Size2D lmin;
|
|
||||||
|
|
||||||
efl_canvas_group_need_recalculate_set(ep->object, 1);
|
|
||||||
efl_canvas_group_calculate(ep->object);
|
|
||||||
lmin = efl_gfx_hint_size_restricted_min_get(ep->object);
|
|
||||||
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
|
|
||||||
{
|
|
||||||
if (lmin.w > minw) minw = lmin.w;
|
|
||||||
}
|
|
||||||
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
|
|
||||||
{
|
|
||||||
if (lmin.h > minh) minh = lmin.h;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ep->part->type == EDJE_PART_TYPE_IMAGE)
|
|
||||||
{
|
|
||||||
if (chosen_desc->min.limit || chosen_desc->max.limit)
|
if (chosen_desc->min.limit || chosen_desc->max.limit)
|
||||||
{
|
_edje_part_recalc_single_image(ed, ep, chosen_desc, pos, &minw, &minh, &maxw, &maxh);
|
||||||
Evas_Coord w, h;
|
EINA_FALLTHROUGH;
|
||||||
|
case EDJE_PART_TYPE_PROXY:
|
||||||
/* We only need pos to find the right image that would be displayed */
|
case EDJE_PART_TYPE_SNAPSHOT:
|
||||||
/* Yes, if someone set aspect preference to SOURCE and also max,min
|
// image. proxy, snapshot share this filter recalc, so fall through
|
||||||
to SOURCE, it will be under efficient, but who cares at the
|
|
||||||
moment. */
|
|
||||||
_edje_real_part_image_set(ed, ep, NULL, pos);
|
|
||||||
evas_object_image_size_get(ep->object, &w, &h);
|
|
||||||
|
|
||||||
if (chosen_desc->min.limit)
|
|
||||||
{
|
|
||||||
if (w > minw) minw = w;
|
|
||||||
if (h > minh) minh = h;
|
|
||||||
}
|
|
||||||
if (chosen_desc->max.limit)
|
|
||||||
{
|
|
||||||
if ((maxw <= 0) || (w < maxw)) maxw = w;
|
|
||||||
if ((maxh <= 0) || (h < maxh)) maxh = h;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
|
||||||
}
|
|
||||||
else if (ep->part->type == EDJE_PART_TYPE_PROXY)
|
|
||||||
{
|
|
||||||
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
|
||||||
}
|
|
||||||
else if (ep->part->type == EDJE_PART_TYPE_SNAPSHOT)
|
|
||||||
{
|
|
||||||
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remember what our size is BEFORE we go limit it */
|
/* remember what our size is BEFORE we go limit it */
|
||||||
|
@ -3044,34 +3133,8 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
_edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Proxy *)desc)->proxy.fill, params);
|
_edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Proxy *)desc)->proxy.fill, params);
|
||||||
|
|
||||||
#ifdef HAVE_EPHYSICS
|
#ifdef HAVE_EPHYSICS
|
||||||
if (ep->part->physics_body || ep->body)
|
if (EINA_UNLIKELY(ep->part->physics_body || ep->body))
|
||||||
{
|
_edje_part_recalc_single_physics(params, desc);
|
||||||
EINA_COW_CALC_PHYSICS_BEGIN(params, params_write)
|
|
||||||
{
|
|
||||||
params_write->mass = desc->physics.mass;
|
|
||||||
params_write->restitution = desc->physics.restitution;
|
|
||||||
params_write->friction = desc->physics.friction;
|
|
||||||
params_write->damping.linear = desc->physics.damping.linear;
|
|
||||||
params_write->damping.angular = desc->physics.damping.angular;
|
|
||||||
params_write->sleep.linear = desc->physics.sleep.linear;
|
|
||||||
params_write->sleep.angular = desc->physics.sleep.angular;
|
|
||||||
params_write->material = desc->physics.material;
|
|
||||||
params_write->density = desc->physics.density;
|
|
||||||
params_write->hardness = desc->physics.hardness;
|
|
||||||
params_write->ignore_part_pos = desc->physics.ignore_part_pos;
|
|
||||||
params_write->light_on = desc->physics.light_on;
|
|
||||||
params_write->mov_freedom.lin.x = desc->physics.mov_freedom.lin.x;
|
|
||||||
params_write->mov_freedom.lin.y = desc->physics.mov_freedom.lin.y;
|
|
||||||
params_write->mov_freedom.lin.z = desc->physics.mov_freedom.lin.z;
|
|
||||||
params_write->mov_freedom.ang.x = desc->physics.mov_freedom.ang.x;
|
|
||||||
params_write->mov_freedom.ang.y = desc->physics.mov_freedom.ang.y;
|
|
||||||
params_write->mov_freedom.ang.z = desc->physics.mov_freedom.ang.z;
|
|
||||||
params_write->backcull = desc->physics.backcull;
|
|
||||||
params_write->z = desc->physics.z;
|
|
||||||
params_write->depth = desc->physics.depth;
|
|
||||||
}
|
|
||||||
EINA_COW_CALC_PHYSICS_END(params, params_write);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
_edje_part_recalc_single_map(ed, ep, center, zoom_center, light, persp, desc, chosen_desc, params);
|
_edje_part_recalc_single_map(ed, ep, center, zoom_center, light, persp, desc, chosen_desc, params);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue