From: Shinwoo Kim Date: Fri, 19 Apr 2019 08:18:26 +0000 (+0900) Subject: Revert "edje_calc: make INTP use TO_INT_ROUND" X-Git-Tag: submit/tizen/20190424.060632~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1867e4834945708490eb3a943e40226f2fc8ed31;p=platform%2Fupstream%2Fefl.git Revert "edje_calc: make INTP use TO_INT_ROUND" Summary: This reverts commit be00af9bc3d534ede3965693618684fe38fd8786 which has incorrect calculation. For more information please refer to: https://phab.enlightenment.org/D8665 Reviewers: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8666 Change-Id: I878418da20ade0396ee218579452e7ded882ffa8 --- diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 543e732..33b5af1 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -2432,29 +2432,12 @@ _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, - Eina_Bool round) + Edje_Calc_Params *params) { - 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 (xw < fxw) + if (ABS(params->final.x) + params->final.w < TO_INT(ADD(ABS(params->eval.x), params->eval.w))) { if (!ed->calc_only) { @@ -2465,7 +2448,7 @@ _edje_part_pixel_adjust(Edje *ed, ep->invalidate = EINA_TRUE; } } - else if (xw > fxw) + else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w))) { if (!ed->calc_only) { @@ -2476,8 +2459,7 @@ _edje_part_pixel_adjust(Edje *ed, ep->invalidate = EINA_TRUE; } } - - if (yh < fyh) + if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h))) { if (!ed->calc_only) { @@ -2488,7 +2470,7 @@ _edje_part_pixel_adjust(Edje *ed, ep->invalidate = EINA_TRUE; } } - else if (yh > fyh) + else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h))) { if (!ed->calc_only) { @@ -2502,6 +2484,7 @@ _edje_part_pixel_adjust(Edje *ed, if (params->final.w < 0 || params->final.h < 0) ERR("The params final size became negative"); + } static void @@ -3075,7 +3058,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, EINA_FALSE); + _edje_part_pixel_adjust(ed, ep, params); /* fill */ if (ep->part->type == EDJE_PART_TYPE_IMAGE) _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params); @@ -3678,7 +3661,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_ROUND(FINTP(_x1, _x2, _p)) +#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p)) static void _map_colors_free(Edje_Calc_Params *pf) @@ -4566,7 +4549,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, EINA_TRUE); + _edje_part_pixel_adjust(ed, ep, p3); if (ep->part->dragable.x) { diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 7b7f887..38d97b9 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -156,9 +156,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) (((a) >= 0.0) \ - ? eina_f32p32_int_to(ADD(a, FROM_DOUBLE(0.5)) \ - : eina_f32p32_int_to(ADD(a, FROM_DOUBLE(-0.5)) +#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) @@ -181,7 +179,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) (((a) >= 0.0) ? (int)(a + 0.5) : (int)(a - 0.5)) +#define TO_INT_ROUND(a) (int)(a + 0.5) #define ZERO 0.0 #define COS(a) cos(a) #define SIN(a) sin(a)