forked from enlightenment/efl
edje_calc: round the scaled value when it is casted to int type.
It rounds the value for the more precious calculation when the scaled value is casted to int type.
This commit is contained in:
parent
7b97d55004
commit
7cce8ae40d
|
@ -2266,7 +2266,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
}
|
||||
|
||||
*minw = mnw;
|
||||
if (ep->part->scale) *minw = TO_INT(SCALE(sc, *minw));
|
||||
if (ep->part->scale) *minw = TO_INT_ROUND(SCALE(sc, *minw));
|
||||
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
||||
(ep->typedata.swallow))
|
||||
{
|
||||
|
@ -2293,7 +2293,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
*maxw = mxw;
|
||||
if (*maxw > 0)
|
||||
{
|
||||
if (ep->part->scale) *maxw = TO_INT(SCALE(sc, *maxw));
|
||||
if (ep->part->scale) *maxw = TO_INT_ROUND(SCALE(sc, *maxw));
|
||||
if (*maxw < 1) *maxw = 1;
|
||||
}
|
||||
}
|
||||
|
@ -2306,7 +2306,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
*maxw = mxw;
|
||||
if (*maxw > 0)
|
||||
{
|
||||
if (ep->part->scale) *maxw = TO_INT(SCALE(sc, *maxw));
|
||||
if (ep->part->scale) *maxw = TO_INT_ROUND(SCALE(sc, *maxw));
|
||||
if (*maxw < 1) *maxw = 1;
|
||||
}
|
||||
if (ep->typedata.swallow->swallow_params.max.w < *maxw)
|
||||
|
@ -2319,7 +2319,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
*maxw = mxw;
|
||||
if (*maxw > 0)
|
||||
{
|
||||
if (ep->part->scale) *maxw = TO_INT(SCALE(sc, *maxw));
|
||||
if (ep->part->scale) *maxw = TO_INT_ROUND(SCALE(sc, *maxw));
|
||||
if (*maxw < 1) *maxw = 1;
|
||||
}
|
||||
}
|
||||
|
@ -2331,7 +2331,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
}
|
||||
|
||||
*minh = mnh;
|
||||
if (ep->part->scale) *minh = TO_INT(SCALE(sc, *minh));
|
||||
if (ep->part->scale) *minh = TO_INT_ROUND(SCALE(sc, *minh));
|
||||
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
||||
(ep->typedata.swallow))
|
||||
{
|
||||
|
@ -2358,7 +2358,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
*maxh = mxh;
|
||||
if (*maxh > 0)
|
||||
{
|
||||
if (ep->part->scale) *maxh = TO_INT(SCALE(sc, *maxh));
|
||||
if (ep->part->scale) *maxh = TO_INT_ROUND(SCALE(sc, *maxh));
|
||||
if (*maxh < 1) *maxh = 1;
|
||||
}
|
||||
}
|
||||
|
@ -2371,7 +2371,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
*maxh = mxh;
|
||||
if (*maxh > 0)
|
||||
{
|
||||
if (ep->part->scale) *maxh = TO_INT(SCALE(sc, *maxh));
|
||||
if (ep->part->scale) *maxh = TO_INT_ROUND(SCALE(sc, *maxh));
|
||||
if (*maxh < 1) *maxh = 1;
|
||||
}
|
||||
if (ep->typedata.swallow->swallow_params.max.h < *maxh)
|
||||
|
@ -2384,7 +2384,7 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
|
|||
*maxh = mxh;
|
||||
if (*maxh > 0)
|
||||
{
|
||||
if (ep->part->scale) *maxh = TO_INT(SCALE(sc, *maxh));
|
||||
if (ep->part->scale) *maxh = TO_INT_ROUND(SCALE(sc, *maxh));
|
||||
if (*maxh < 1) *maxh = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,6 +148,7 @@ EAPI extern int _edje_default_log_dom ;
|
|||
#define FROM_DOUBLE(a) eina_f32p32_double_from(a)
|
||||
#define FROM_INT(a) eina_f32p32_int_from(a)
|
||||
#define TO_INT(a) eina_f32p32_int_to(a)
|
||||
#define TO_INT_ROUND(a) eina_f32p32_int_to(ADD(a, FROM_DOUBLE(0.5)))
|
||||
#define ZERO 0
|
||||
#define COS(a) eina_f32p32_cos(a)
|
||||
#define SIN(a) eina_f32p32_sin(a)
|
||||
|
@ -168,6 +169,7 @@ EAPI extern int _edje_default_log_dom ;
|
|||
#define FROM_DOUBLE(a) (a)
|
||||
#define FROM_INT(a) (double)(a)
|
||||
#define TO_INT(a) (int)(a)
|
||||
#define TO_INT_ROUND(a) (int)(a + 0.5)
|
||||
#define ZERO 0.0
|
||||
#define COS(a) cos(a)
|
||||
#define SIN(a) sin(a)
|
||||
|
|
Loading…
Reference in New Issue