* edje: remove use of flags as it was always set to FLAG_XY

in _edje_part_recalc_single.


SVN revision: 52245
This commit is contained in:
Cedric BAIL 2010-09-14 15:53:47 +00:00
parent d1203fc0ca
commit 2e87895f67
1 changed files with 235 additions and 294 deletions

View File

@ -12,7 +12,7 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep,
Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc,
Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
Edje_Real_Part *confine_to, Edje_Calc_Params *params, int flags);
Edje_Real_Part *confine_to, Edje_Calc_Params *params);
static void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags);
void
@ -367,12 +367,10 @@ _edje_part_recalc_single_rel(Edje *ed,
Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x,
Edje_Real_Part *rel2_to_y,
Edje_Calc_Params *params,
int flags)
Edje_Calc_Params *params)
{
if (flags & FLAG_X)
{
FLOAT_T x, w;
FLOAT_T y, h;
if (rel1_to_x)
x = ADD(FROM_INT(desc->rel1.offset_x + rel1_to_x->x),
@ -393,10 +391,6 @@ _edje_part_recalc_single_rel(Edje *ed,
x),
FROM_INT(1));
params->w = TO_INT(w);
}
if (flags & FLAG_Y)
{
FLOAT_T y, h;
if (rel1_to_y)
y = ADD(FROM_INT(desc->rel1.offset_y + rel1_to_y->y),
@ -417,7 +411,6 @@ _edje_part_recalc_single_rel(Edje *ed,
y),
FROM_INT(1));
params->h = TO_INT(h);
}
}
static void
@ -623,11 +616,8 @@ _edje_part_recalc_single_aspect(Edje_Real_Part *ep,
static void
_edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params,
int flags)
Edje_Calc_Params *params)
{
if (flags & FLAG_X)
{
if (desc->step.x > 0)
{
int steps;
@ -641,9 +631,7 @@ _edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
params->w = new_w;
}
}
}
if (flags & FLAG_Y)
{
if (desc->step.y > 0)
{
int steps;
@ -657,7 +645,6 @@ _edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
params->h = new_h;
}
}
}
}
static void
@ -971,8 +958,7 @@ _edje_part_recalc_single_min_length(FLOAT_T align, int *start, int *length, int
static void
_edje_part_recalc_single_min(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params,
int minw, int minh,
int flags __UNUSED__)
int minw, int minh)
{
int tmp;
int w;
@ -1037,8 +1023,7 @@ _edje_part_recalc_single_max_length(FLOAT_T align, int *start, int *length, int
static void
_edje_part_recalc_single_max(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params,
int maxw, int maxh,
int flags __UNUSED__)
int maxw, int maxh)
{
int tmp;
int w;
@ -1092,8 +1077,7 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
Edje_Real_Part *confine_to,
Edje_Calc_Params *params,
int minw, int minh,
int maxw, int maxh,
int flags)
int maxw, int maxh)
{
/* confine */
if (confine_to)
@ -1103,8 +1087,6 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
FLOAT_T v;
/* complex dragable params */
if (flags & FLAG_X)
{
v = SCALE(ep->drag->size.x, confine_to->w);
if ((minw > 0) && (TO_INT(v) < minw)) params->w = minw;
@ -1127,9 +1109,7 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
}
params->req_drag.x = params->x;
params->req_drag.w = params->w;
}
if (flags & FLAG_Y)
{
v = SCALE(ep->drag->size.y, confine_to->h);
if ((minh > 0) && (TO_INT(v) < minh)) params->h = minh;
@ -1152,10 +1132,8 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
}
params->req_drag.y = params->y;
params->req_drag.h = params->h;
}
/* limit to confine */
if (flags & FLAG_X)
{
if (params->x < confine_to->x)
{
params->x = confine_to->x;
@ -1164,9 +1142,6 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
{
params->x = confine_to->x + confine_to->w - params->w;
}
}
if (flags & FLAG_Y)
{
if (params->y < confine_to->y)
{
params->y = confine_to->y;
@ -1176,35 +1151,28 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
params->y = confine_to->y + confine_to->h - params->h;
}
}
}
else
{
/* simple dragable params */
if (flags & FLAG_X)
{
params->x += TO_INT(ep->drag->x) + ep->drag->tmp.x;
params->req_drag.x = params->x;
params->req_drag.w = params->w;
}
if (flags & FLAG_Y)
{
params->y += TO_INT(ep->drag->y) + ep->drag->tmp.y;
params->req_drag.y = params->y;
params->req_drag.h = params->h;
}
}
}
static void
_edje_part_recalc_single_fill(Edje_Real_Part *ep,
Edje_Part_Description_Spec_Image *desc,
Edje_Calc_Params *params,
int flags)
Edje_Calc_Params *params)
{
params->smooth = desc->fill.smooth;
if (flags & FLAG_X)
{
int fw;
int fh;
params->smooth = desc->fill.smooth;
if (desc->fill.type == EDJE_FILL_TYPE_TILE)
evas_object_image_size_get(ep->object, &fw, NULL);
@ -1215,10 +1183,6 @@ _edje_part_recalc_single_fill(Edje_Real_Part *ep,
+ TO_INT(SCALE(desc->fill.pos_rel_x, fw));
params->type.common.fill.w = desc->fill.abs_x
+ TO_INT(SCALE(desc->fill.rel_x, fw));
}
if (flags & FLAG_Y)
{
int fh;
if (desc->fill.type == EDJE_FILL_TYPE_TILE)
evas_object_image_size_get(ep->object, NULL, &fh);
@ -1229,7 +1193,7 @@ _edje_part_recalc_single_fill(Edje_Real_Part *ep,
+ TO_INT(SCALE(desc->fill.pos_rel_y, fh));
params->type.common.fill.h = desc->fill.abs_y
+ TO_INT(SCALE(desc->fill.rel_y, fh));
}
params->type.common.fill.angle = desc->fill.angle;
params->type.common.fill.spread = desc->fill.spread;
}
@ -1239,11 +1203,8 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
Edje_Real_Part *ep,
Edje_Part_Description_Common *desc,
int *minw, int *minh,
int *maxw, int *maxh,
int flags __UNUSED__)
int *maxw, int *maxh)
{
// if (flags & FLAG_X)
{
*minw = desc->min.w;
if (ep->part->scale) *minw = TO_INT(SCALE(sc, *minw));
if (ep->swallow_params.min.w > desc->min.w)
@ -1280,9 +1241,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
{
if (*maxw < *minw) *maxw = *minw;
}
}
// if (flags & FLAG_Y)
{
*minh = desc->min.h;
if (ep->part->scale) *minh = TO_INT(SCALE(sc, *minh));
if (ep->swallow_params.min.h > desc->min.h)
@ -1319,7 +1278,6 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
{
if (*maxh < *minh) *maxh = *minh;
}
}
}
static void
@ -1332,28 +1290,24 @@ _edje_part_recalc_single(Edje *ed,
Edje_Real_Part *rel2_to_x,
Edje_Real_Part *rel2_to_y,
Edje_Real_Part *confine_to,
Edje_Calc_Params *params,
int flags)
Edje_Calc_Params *params)
{
Edje_Color_Class *cc = NULL;
int minw = 0, minh = 0, maxw = 0, maxh = 0;
FLOAT_T sc;
flags = FLAG_XY;
sc = ed->scale;
if (sc == 0.0) sc = _edje_scale;
_edje_part_recalc_single_min_max(sc, ep, desc, &minw, &minh, &maxw, &maxh, flags);
_edje_part_recalc_single_min_max(sc, ep, desc, &minw, &minh, &maxw, &maxh);
/* relative coords of top left & bottom right */
_edje_part_recalc_single_rel(ed, ep, desc, rel1_to_x, rel1_to_y, rel2_to_x, rel2_to_y, params, flags);
_edje_part_recalc_single_rel(ed, ep, desc, rel1_to_x, rel1_to_y, rel2_to_x, rel2_to_y, params);
/* aspect */
if (((flags | ep->calculated) & FLAG_XY) == FLAG_XY)
_edje_part_recalc_single_aspect(ep, desc, params, &minw, &minh, &maxw, &maxh);
/* size step */
_edje_part_recalc_single_step(desc, params, flags);
_edje_part_recalc_single_step(desc, params);
/* if we have text that wants to make the min size the text size... */
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
@ -1368,18 +1322,18 @@ _edje_part_recalc_single(Edje *ed,
params->req.h = params->h;
/* adjust for min size */
_edje_part_recalc_single_min(desc, params, minw, minh, flags);
_edje_part_recalc_single_min(desc, params, minw, minh);
/* adjust for max size */
_edje_part_recalc_single_max(desc, params, maxw, maxh, flags);
_edje_part_recalc_single_max(desc, params, maxw, maxh);
/* take care of dragable part */
if (ep->drag)
_edje_part_recalc_single_drag(ep, confine_to, params, minw, minh, maxw, maxh, flags);
_edje_part_recalc_single_drag(ep, confine_to, params, minw, minh, maxw, maxh);
/* fill */
if (ep->part->type == EDJE_PART_TYPE_IMAGE)
_edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image, params, flags);
_edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image, params);
/* colors */
if ((desc->color_class) && (*desc->color_class))
@ -1410,16 +1364,11 @@ _edje_part_recalc_single(Edje *ed,
Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) desc;
/* border */
if (flags & FLAG_X)
{
params->type.common.spec.image.l = img_desc->image.border.l;
params->type.common.spec.image.r = img_desc->image.border.r;
}
if (flags & FLAG_Y)
{
params->type.common.spec.image.t = img_desc->image.border.t;
params->type.common.spec.image.b = img_desc->image.border.b;
}
break;
}
case EDJE_PART_TYPE_TEXT:
@ -1428,14 +1377,8 @@ _edje_part_recalc_single(Edje *ed,
Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text*) desc;
/* text.align */
if (flags & FLAG_X)
{
params->type.text.align.x = text_desc->text.align.x;
}
if (flags & FLAG_Y)
{
params->type.text.align.y = text_desc->text.align.y;
}
params->type.text.elipsis = text_desc->text.elipsis;
/* text colors */
@ -1896,8 +1839,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
_edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc,
ep->param1.rel1_to_x, ep->param1.rel1_to_y, ep->param1.rel2_to_x, ep->param1.rel2_to_y,
confine_to,
p1,
flags);
p1);
#ifdef EDJE_CALC_CACHE
ep->param1.state = ed->state;
@ -1926,8 +1868,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
_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);
p2);
#ifdef EDJE_CALC_CACHE
ep->param2->state = ed->state;
#endif