From: Shinwoo Kim Date: Fri, 8 Mar 2019 04:28:21 +0000 (+0900) Subject: edje_calc: make INTP use TO_INT_ROUND X-Git-Tag: submit/tizen/20190314.062257~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53b2ec623ca495d950ec17dc227fd8a7c31a59e7;p=platform%2Fupstream%2Fefl.git edje_calc: make INTP use TO_INT_ROUND Summary: The edje_part_recalc calculates next postion(p3). Please refer to following line. p3->final.y = INTP(p1->final.y, p2->final.y, pos); If the condition is as blow, then p3->final.y becomes -50 only if pos is 1.0. Because INP uses TO_INT not TO_INT_ROUND. p1->final.y == -32 p2->final.y == -50 So we had nonsmooth ending of transition. Test Plan: Sample application to check this issue. Please look carefully when the rect moves from bottom to top. {F3627740} {F3627739} Reviewers: cedric, Hermet, jypark Reviewed By: Hermet Subscribers: zmike, akanad, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7842 --- diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 33b5af1..543e732 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -2432,12 +2432,29 @@ _edje_filter_get(Edje *ed, Edje_Part_Description_Spec_Filter *filter) static void _edje_part_pixel_adjust(Edje *ed, Edje_Real_Part *ep, - Edje_Calc_Params *params) + Edje_Calc_Params *params, + Eina_Bool round) { + int xw, yh, fxw, fyh; + + xw = ABS(params->final.x) + params->final.w; + yh = ABS(params->final.y) + params->final.h; + + if (round) + { + fxw = TO_INT_ROUND(ADD(ABS(params->eval.x), params->eval.w)); + fyh = TO_INT_ROUND(ADD(ABS(params->eval.y), params->eval.h)); + } + else + { + fxw = TO_INT(ADD(ABS(params->eval.x), params->eval.w)); + fyh = TO_INT(ADD(ABS(params->eval.y), params->eval.h)); + } + /* Adjust rounding to not loose one pixels compared to float information only when rendering to avoid infinite adjustement when doing min restricted calc */ - if (ABS(params->final.x) + params->final.w < TO_INT(ADD(ABS(params->eval.x), params->eval.w))) + if (xw < fxw) { if (!ed->calc_only) { @@ -2448,7 +2465,7 @@ _edje_part_pixel_adjust(Edje *ed, ep->invalidate = EINA_TRUE; } } - else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w))) + else if (xw > fxw) { if (!ed->calc_only) { @@ -2459,7 +2476,8 @@ _edje_part_pixel_adjust(Edje *ed, ep->invalidate = EINA_TRUE; } } - if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h))) + + if (yh < fyh) { if (!ed->calc_only) { @@ -2470,7 +2488,7 @@ _edje_part_pixel_adjust(Edje *ed, ep->invalidate = EINA_TRUE; } } - else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h))) + else if (yh > fyh) { if (!ed->calc_only) { @@ -2484,7 +2502,6 @@ _edje_part_pixel_adjust(Edje *ed, if (params->final.w < 0 || params->final.h < 0) ERR("The params final size became negative"); - } static void @@ -3058,7 +3075,7 @@ _edje_part_recalc_single(Edje *ed, params->final.w = TO_INT(params->eval.w); params->final.h = TO_INT(params->eval.h); - _edje_part_pixel_adjust(ed, ep, params); + _edje_part_pixel_adjust(ed, ep, params, EINA_FALSE); /* fill */ if (ep->part->type == EDJE_PART_TYPE_IMAGE) _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params); @@ -3661,7 +3678,7 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world) ? (_x1) \ : ADD(_x1, MUL(_p, SUB(_x2, _x1)))); -#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p)) +#define INTP(_x1, _x2, _p) TO_INT_ROUND(FINTP(_x1, _x2, _p)) static void _map_colors_free(Edje_Calc_Params *pf) @@ -4549,7 +4566,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta p3->req.w = INTP(p1->req.w, p2->req.w, pos); p3->req.h = INTP(p1->req.h, p2->req.h, pos); - _edje_part_pixel_adjust(ed, ep, p3); + _edje_part_pixel_adjust(ed, ep, p3, EINA_TRUE); if (ep->part->dragable.x) { diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 38d97b9..7b7f887 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -156,7 +156,9 @@ 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 TO_INT_ROUND(a) (((a) >= 0.0) \ + ? eina_f32p32_int_to(ADD(a, FROM_DOUBLE(0.5)) \ + : 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) @@ -179,7 +181,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 TO_INT_ROUND(a) (((a) >= 0.0) ? (int)(a + 0.5) : (int)(a - 0.5)) #define ZERO 0.0 #define COS(a) cos(a) #define SIN(a) sin(a)