forked from enlightenment/efl
trying to make the code more readable
SVN revision: 12082
This commit is contained in:
parent
76eb6e53cb
commit
67defc4296
|
@ -18,8 +18,8 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos)
|
||||||
{
|
{
|
||||||
double npos;
|
double npos;
|
||||||
|
|
||||||
if (pos > 1.0) pos = 1.0;
|
pos = CLAMP(pos, 0.0, 1.0);
|
||||||
else if (pos < 0.0) pos = 0.0;
|
|
||||||
npos = 0.0;
|
npos = 0.0;
|
||||||
/* take linear pos along timescale and use interpolation method */
|
/* take linear pos along timescale and use interpolation method */
|
||||||
switch (mode)
|
switch (mode)
|
||||||
|
@ -193,22 +193,19 @@ _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y)
|
||||||
if (ep->confine_to)
|
if (ep->confine_to)
|
||||||
{
|
{
|
||||||
double dx, dy, dw, dh;
|
double dx, dy, dw, dh;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
if ((ep->part->dragable.x != 0) &&
|
if ((ep->part->dragable.x != 0) &&
|
||||||
(ep->part->dragable.y != 0 )) ret = 3;
|
(ep->part->dragable.y != 0 )) ret = 3;
|
||||||
else if (ep->part->dragable.x != 0) ret = 1;
|
else if (ep->part->dragable.x != 0) ret = 1;
|
||||||
else if (ep->part->dragable.y != 0) ret = 2;
|
else if (ep->part->dragable.y != 0) ret = 2;
|
||||||
|
|
||||||
dx = ep->x - ep->confine_to->x;
|
dx = ep->x - ep->confine_to->x;
|
||||||
dw = ep->confine_to->w - ep->w;
|
dw = MAX(ep->confine_to->w - ep->w, 1);
|
||||||
if (dw < 1) dw = 1;
|
|
||||||
dx /= dw;
|
dx /= dw;
|
||||||
|
|
||||||
dy = ep->y - ep->confine_to->y;
|
dy = ep->y - ep->confine_to->y;
|
||||||
dh = ep->confine_to->h - ep->h;
|
dh = MAX(ep->confine_to->h - ep->h, 1);
|
||||||
if (dh < 1) dh = 1;
|
|
||||||
dy /= dh;
|
dy /= dh;
|
||||||
|
|
||||||
if (x) *x = dx;
|
if (x) *x = dx;
|
||||||
|
@ -854,26 +851,13 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
|
||||||
|
|
||||||
/* visible is special */
|
/* visible is special */
|
||||||
if ((p1.visible) && (!p2.visible))
|
if ((p1.visible) && (!p2.visible))
|
||||||
{
|
p3.visible = (pos != 1.0);
|
||||||
if (pos == 1.0)
|
|
||||||
p3.visible = 0;
|
|
||||||
else
|
|
||||||
p3.visible = 1;
|
|
||||||
}
|
|
||||||
else if ((!p1.visible) && (p2.visible))
|
else if ((!p1.visible) && (p2.visible))
|
||||||
{
|
p3.visible = (pos != 0.0);
|
||||||
if (pos == 0.0)
|
|
||||||
p3.visible = 0;
|
|
||||||
else
|
|
||||||
p3.visible = 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
p3.visible = p1.visible;
|
p3.visible = p1.visible;
|
||||||
|
|
||||||
if (pos < 0.5)
|
p3.smooth = (pos < 0.5) ? p1.smooth : p2.smooth;
|
||||||
p3.smooth = p1.smooth;
|
|
||||||
else
|
|
||||||
p3.smooth = p2.smooth;
|
|
||||||
|
|
||||||
/* FIXME: do x and y separately base on flag */
|
/* FIXME: do x and y separately base on flag */
|
||||||
p3.x = (p1.x * (1.0 - pos)) + (p2.x * (pos));
|
p3.x = (p1.x * (1.0 - pos)) + (p2.x * (pos));
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
#define ABS(x) (x < 0 ? -x : x)
|
#define ABS(x) (x < 0 ? -x : x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CLAMP
|
||||||
|
#define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* increment this when the EET data descriptors have changed and old
|
/* increment this when the EET data descriptors have changed and old
|
||||||
* EETs cannot be loaded/used correctly anymore.
|
* EETs cannot be loaded/used correctly anymore.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue