* 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_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 *rel1_to_x, Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_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); static void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags);
void void
@ -367,12 +367,10 @@ _edje_part_recalc_single_rel(Edje *ed,
Edje_Real_Part *rel1_to_y, Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_x,
Edje_Real_Part *rel2_to_y, Edje_Real_Part *rel2_to_y,
Edje_Calc_Params *params, Edje_Calc_Params *params)
int flags)
{
if (flags & FLAG_X)
{ {
FLOAT_T x, w; FLOAT_T x, w;
FLOAT_T y, h;
if (rel1_to_x) if (rel1_to_x)
x = ADD(FROM_INT(desc->rel1.offset_x + rel1_to_x->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), x),
FROM_INT(1)); FROM_INT(1));
params->w = TO_INT(w); params->w = TO_INT(w);
}
if (flags & FLAG_Y)
{
FLOAT_T y, h;
if (rel1_to_y) if (rel1_to_y)
y = ADD(FROM_INT(desc->rel1.offset_y + rel1_to_y->y), y = ADD(FROM_INT(desc->rel1.offset_y + rel1_to_y->y),
@ -418,7 +412,6 @@ _edje_part_recalc_single_rel(Edje *ed,
FROM_INT(1)); FROM_INT(1));
params->h = TO_INT(h); params->h = TO_INT(h);
} }
}
static void static void
_edje_part_recalc_single_aspect(Edje_Real_Part *ep, _edje_part_recalc_single_aspect(Edje_Real_Part *ep,
@ -623,10 +616,7 @@ _edje_part_recalc_single_aspect(Edje_Real_Part *ep,
static void static void
_edje_part_recalc_single_step(Edje_Part_Description_Common *desc, _edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params, Edje_Calc_Params *params)
int flags)
{
if (flags & FLAG_X)
{ {
if (desc->step.x > 0) if (desc->step.x > 0)
{ {
@ -641,9 +631,7 @@ _edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
params->w = new_w; params->w = new_w;
} }
} }
}
if (flags & FLAG_Y)
{
if (desc->step.y > 0) if (desc->step.y > 0)
{ {
int steps; int steps;
@ -658,7 +646,6 @@ _edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
} }
} }
} }
}
static void static void
_edje_part_recalc_single_textblock(FLOAT_T sc, _edje_part_recalc_single_textblock(FLOAT_T sc,
@ -971,8 +958,7 @@ _edje_part_recalc_single_min_length(FLOAT_T align, int *start, int *length, int
static void static void
_edje_part_recalc_single_min(Edje_Part_Description_Common *desc, _edje_part_recalc_single_min(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params, Edje_Calc_Params *params,
int minw, int minh, int minw, int minh)
int flags __UNUSED__)
{ {
int tmp; int tmp;
int w; int w;
@ -1037,8 +1023,7 @@ _edje_part_recalc_single_max_length(FLOAT_T align, int *start, int *length, int
static void static void
_edje_part_recalc_single_max(Edje_Part_Description_Common *desc, _edje_part_recalc_single_max(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params, Edje_Calc_Params *params,
int maxw, int maxh, int maxw, int maxh)
int flags __UNUSED__)
{ {
int tmp; int tmp;
int w; int w;
@ -1092,8 +1077,7 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
Edje_Real_Part *confine_to, Edje_Real_Part *confine_to,
Edje_Calc_Params *params, Edje_Calc_Params *params,
int minw, int minh, int minw, int minh,
int maxw, int maxh, int maxw, int maxh)
int flags)
{ {
/* confine */ /* confine */
if (confine_to) if (confine_to)
@ -1103,8 +1087,6 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
FLOAT_T v; FLOAT_T v;
/* complex dragable params */ /* complex dragable params */
if (flags & FLAG_X)
{
v = SCALE(ep->drag->size.x, confine_to->w); v = SCALE(ep->drag->size.x, confine_to->w);
if ((minw > 0) && (TO_INT(v) < minw)) params->w = minw; 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.x = params->x;
params->req_drag.w = params->w; params->req_drag.w = params->w;
}
if (flags & FLAG_Y)
{
v = SCALE(ep->drag->size.y, confine_to->h); v = SCALE(ep->drag->size.y, confine_to->h);
if ((minh > 0) && (TO_INT(v) < minh)) params->h = minh; 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.y = params->y;
params->req_drag.h = params->h; params->req_drag.h = params->h;
}
/* limit to confine */ /* limit to confine */
if (flags & FLAG_X)
{
if (params->x < confine_to->x) if (params->x < confine_to->x)
{ {
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; params->x = confine_to->x + confine_to->w - params->w;
} }
}
if (flags & FLAG_Y)
{
if (params->y < confine_to->y) if (params->y < confine_to->y)
{ {
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; params->y = confine_to->y + confine_to->h - params->h;
} }
} }
}
else else
{ {
/* simple dragable params */ /* simple dragable params */
if (flags & FLAG_X)
{
params->x += TO_INT(ep->drag->x) + ep->drag->tmp.x; params->x += TO_INT(ep->drag->x) + ep->drag->tmp.x;
params->req_drag.x = params->x; params->req_drag.x = params->x;
params->req_drag.w = params->w; params->req_drag.w = params->w;
}
if (flags & FLAG_Y)
{
params->y += TO_INT(ep->drag->y) + ep->drag->tmp.y; params->y += TO_INT(ep->drag->y) + ep->drag->tmp.y;
params->req_drag.y = params->y; params->req_drag.y = params->y;
params->req_drag.h = params->h; params->req_drag.h = params->h;
} }
} }
}
static void static void
_edje_part_recalc_single_fill(Edje_Real_Part *ep, _edje_part_recalc_single_fill(Edje_Real_Part *ep,
Edje_Part_Description_Spec_Image *desc, Edje_Part_Description_Spec_Image *desc,
Edje_Calc_Params *params, Edje_Calc_Params *params)
int flags)
{
params->smooth = desc->fill.smooth;
if (flags & FLAG_X)
{ {
int fw; int fw;
int fh;
params->smooth = desc->fill.smooth;
if (desc->fill.type == EDJE_FILL_TYPE_TILE) if (desc->fill.type == EDJE_FILL_TYPE_TILE)
evas_object_image_size_get(ep->object, &fw, NULL); 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)); + TO_INT(SCALE(desc->fill.pos_rel_x, fw));
params->type.common.fill.w = desc->fill.abs_x params->type.common.fill.w = desc->fill.abs_x
+ TO_INT(SCALE(desc->fill.rel_x, fw)); + TO_INT(SCALE(desc->fill.rel_x, fw));
}
if (flags & FLAG_Y)
{
int fh;
if (desc->fill.type == EDJE_FILL_TYPE_TILE) if (desc->fill.type == EDJE_FILL_TYPE_TILE)
evas_object_image_size_get(ep->object, NULL, &fh); 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)); + TO_INT(SCALE(desc->fill.pos_rel_y, fh));
params->type.common.fill.h = desc->fill.abs_y params->type.common.fill.h = desc->fill.abs_y
+ TO_INT(SCALE(desc->fill.rel_y, fh)); + TO_INT(SCALE(desc->fill.rel_y, fh));
}
params->type.common.fill.angle = desc->fill.angle; params->type.common.fill.angle = desc->fill.angle;
params->type.common.fill.spread = desc->fill.spread; params->type.common.fill.spread = desc->fill.spread;
} }
@ -1239,10 +1203,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
Edje_Real_Part *ep, Edje_Real_Part *ep,
Edje_Part_Description_Common *desc, Edje_Part_Description_Common *desc,
int *minw, int *minh, int *minw, int *minh,
int *maxw, int *maxh, int *maxw, int *maxh)
int flags __UNUSED__)
{
// if (flags & FLAG_X)
{ {
*minw = desc->min.w; *minw = desc->min.w;
if (ep->part->scale) *minw = TO_INT(SCALE(sc, *minw)); if (ep->part->scale) *minw = TO_INT(SCALE(sc, *minw));
@ -1280,9 +1241,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
{ {
if (*maxw < *minw) *maxw = *minw; if (*maxw < *minw) *maxw = *minw;
} }
}
// if (flags & FLAG_Y)
{
*minh = desc->min.h; *minh = desc->min.h;
if (ep->part->scale) *minh = TO_INT(SCALE(sc, *minh)); if (ep->part->scale) *minh = TO_INT(SCALE(sc, *minh));
if (ep->swallow_params.min.h > desc->min.h) if (ep->swallow_params.min.h > desc->min.h)
@ -1320,7 +1279,6 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
if (*maxh < *minh) *maxh = *minh; if (*maxh < *minh) *maxh = *minh;
} }
} }
}
static void static void
_edje_part_recalc_single(Edje *ed, _edje_part_recalc_single(Edje *ed,
@ -1332,28 +1290,24 @@ _edje_part_recalc_single(Edje *ed,
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_x,
Edje_Real_Part *rel2_to_y, Edje_Real_Part *rel2_to_y,
Edje_Real_Part *confine_to, Edje_Real_Part *confine_to,
Edje_Calc_Params *params, Edje_Calc_Params *params)
int flags)
{ {
Edje_Color_Class *cc = NULL; Edje_Color_Class *cc = NULL;
int minw = 0, minh = 0, maxw = 0, maxh = 0; int minw = 0, minh = 0, maxw = 0, maxh = 0;
FLOAT_T sc; FLOAT_T sc;
flags = FLAG_XY;
sc = ed->scale; sc = ed->scale;
if (sc == 0.0) sc = _edje_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 */ /* 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 */ /* aspect */
if (((flags | ep->calculated) & FLAG_XY) == FLAG_XY)
_edje_part_recalc_single_aspect(ep, desc, params, &minw, &minh, &maxw, &maxh); _edje_part_recalc_single_aspect(ep, desc, params, &minw, &minh, &maxw, &maxh);
/* size step */ /* 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 we have text that wants to make the min size the text size... */
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
@ -1368,18 +1322,18 @@ _edje_part_recalc_single(Edje *ed,
params->req.h = params->h; params->req.h = params->h;
/* adjust for min size */ /* 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 */ /* 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 */ /* take care of dragable part */
if (ep->drag) 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 */ /* fill */
if (ep->part->type == EDJE_PART_TYPE_IMAGE) 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 */ /* colors */
if ((desc->color_class) && (*desc->color_class)) 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; Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) desc;
/* border */ /* border */
if (flags & FLAG_X)
{
params->type.common.spec.image.l = img_desc->image.border.l; 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.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.t = img_desc->image.border.t;
params->type.common.spec.image.b = img_desc->image.border.b; params->type.common.spec.image.b = img_desc->image.border.b;
}
break; break;
} }
case EDJE_PART_TYPE_TEXT: 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; Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text*) desc;
/* text.align */ /* text.align */
if (flags & FLAG_X)
{
params->type.text.align.x = text_desc->text.align.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.align.y = text_desc->text.align.y;
}
params->type.text.elipsis = text_desc->text.elipsis; params->type.text.elipsis = text_desc->text.elipsis;
/* text colors */ /* 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, _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, ep->param1.rel1_to_x, ep->param1.rel1_to_y, ep->param1.rel2_to_x, ep->param1.rel2_to_y,
confine_to, confine_to,
p1, p1);
flags);
#ifdef EDJE_CALC_CACHE #ifdef EDJE_CALC_CACHE
ep->param1.state = ed->state; 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, _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, ep->param2->rel1_to_x, ep->param2->rel1_to_y, ep->param2->rel2_to_x, ep->param2->rel2_to_y,
confine_to, confine_to,
p2, p2);
flags);
#ifdef EDJE_CALC_CACHE #ifdef EDJE_CALC_CACHE
ep->param2->state = ed->state; ep->param2->state = ed->state;
#endif #endif