summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2019-03-08 13:28:21 +0900
committerHermet Park <hermetpark@gmail.com>2019-03-08 13:28:22 +0900
commitbe00af9bc3d534ede3965693618684fe38fd8786 (patch)
tree12018db0e434689e897519fc42f7b58bab3a02ad
parent97416e99969897114ea8a95578d19500f9b7863f (diff)
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
-rw-r--r--src/lib/edje/edje_calc.c35
-rw-r--r--src/lib/edje/edje_private.h6
2 files changed, 30 insertions, 11 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index ffb46c075b..3e3bf29850 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -2397,12 +2397,29 @@ _edje_filter_get(Edje *ed, Edje_Part_Description_Spec_Filter *filter)
2397static void 2397static void
2398_edje_part_pixel_adjust(Edje *ed, 2398_edje_part_pixel_adjust(Edje *ed,
2399 Edje_Real_Part *ep, 2399 Edje_Real_Part *ep,
2400 Edje_Calc_Params *params) 2400 Edje_Calc_Params *params,
2401 Eina_Bool round)
2401{ 2402{
2403 int xw, yh, fxw, fyh;
2404
2405 xw = ABS(params->final.x) + params->final.w;
2406 yh = ABS(params->final.y) + params->final.h;
2407
2408 if (round)
2409 {
2410 fxw = TO_INT_ROUND(ADD(ABS(params->eval.x), params->eval.w));
2411 fyh = TO_INT_ROUND(ADD(ABS(params->eval.y), params->eval.h));
2412 }
2413 else
2414 {
2415 fxw = TO_INT(ADD(ABS(params->eval.x), params->eval.w));
2416 fyh = TO_INT(ADD(ABS(params->eval.y), params->eval.h));
2417 }
2418
2402 /* Adjust rounding to not loose one pixels compared to float 2419 /* Adjust rounding to not loose one pixels compared to float
2403 information only when rendering to avoid infinite adjustement 2420 information only when rendering to avoid infinite adjustement
2404 when doing min restricted calc */ 2421 when doing min restricted calc */
2405 if (ABS(params->final.x) + params->final.w < TO_INT(ADD(ABS(params->eval.x), params->eval.w))) 2422 if (xw < fxw)
2406 { 2423 {
2407 if (!ed->calc_only) 2424 if (!ed->calc_only)
2408 { 2425 {
@@ -2413,7 +2430,7 @@ _edje_part_pixel_adjust(Edje *ed,
2413 ep->invalidate = EINA_TRUE; 2430 ep->invalidate = EINA_TRUE;
2414 } 2431 }
2415 } 2432 }
2416 else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w))) 2433 else if (xw > fxw)
2417 { 2434 {
2418 if (!ed->calc_only) 2435 if (!ed->calc_only)
2419 { 2436 {
@@ -2424,7 +2441,8 @@ _edje_part_pixel_adjust(Edje *ed,
2424 ep->invalidate = EINA_TRUE; 2441 ep->invalidate = EINA_TRUE;
2425 } 2442 }
2426 } 2443 }
2427 if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h))) 2444
2445 if (yh < fyh)
2428 { 2446 {
2429 if (!ed->calc_only) 2447 if (!ed->calc_only)
2430 { 2448 {
@@ -2435,7 +2453,7 @@ _edje_part_pixel_adjust(Edje *ed,
2435 ep->invalidate = EINA_TRUE; 2453 ep->invalidate = EINA_TRUE;
2436 } 2454 }
2437 } 2455 }
2438 else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h))) 2456 else if (yh > fyh)
2439 { 2457 {
2440 if (!ed->calc_only) 2458 if (!ed->calc_only)
2441 { 2459 {
@@ -2449,7 +2467,6 @@ _edje_part_pixel_adjust(Edje *ed,
2449 2467
2450 if (params->final.w < 0 || params->final.h < 0) 2468 if (params->final.w < 0 || params->final.h < 0)
2451 ERR("The params final size became negative"); 2469 ERR("The params final size became negative");
2452
2453} 2470}
2454 2471
2455static void 2472static void
@@ -2994,7 +3011,7 @@ _edje_part_recalc_single(Edje *ed,
2994 params->final.w = TO_INT(params->eval.w); 3011 params->final.w = TO_INT(params->eval.w);
2995 params->final.h = TO_INT(params->eval.h); 3012 params->final.h = TO_INT(params->eval.h);
2996 3013
2997 _edje_part_pixel_adjust(ed, ep, params); 3014 _edje_part_pixel_adjust(ed, ep, params, EINA_FALSE);
2998 /* fill */ 3015 /* fill */
2999 if (ep->part->type == EDJE_PART_TYPE_IMAGE) 3016 if (ep->part->type == EDJE_PART_TYPE_IMAGE)
3000 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params); 3017 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params);
@@ -3456,7 +3473,7 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world)
3456 ? (_x1) \ 3473 ? (_x1) \
3457 : ADD(_x1, MUL(_p, SUB(_x2, _x1)))); 3474 : ADD(_x1, MUL(_p, SUB(_x2, _x1))));
3458 3475
3459#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p)) 3476#define INTP(_x1, _x2, _p) TO_INT_ROUND(FINTP(_x1, _x2, _p))
3460 3477
3461static void 3478static void
3462_map_colors_free(Edje_Calc_Params *pf) 3479_map_colors_free(Edje_Calc_Params *pf)
@@ -4343,7 +4360,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4343 p3->req.w = INTP(p1->req.w, p2->req.w, pos); 4360 p3->req.w = INTP(p1->req.w, p2->req.w, pos);
4344 p3->req.h = INTP(p1->req.h, p2->req.h, pos); 4361 p3->req.h = INTP(p1->req.h, p2->req.h, pos);
4345 4362
4346 _edje_part_pixel_adjust(ed, ep, p3); 4363 _edje_part_pixel_adjust(ed, ep, p3, EINA_TRUE);
4347 4364
4348 if (ep->part->dragable.x) 4365 if (ep->part->dragable.x)
4349 { 4366 {
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index a92e5b1273..6ae592680f 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -155,7 +155,9 @@ EAPI extern int _edje_default_log_dom ;
155#define FROM_DOUBLE(a) eina_f32p32_double_from(a) 155#define FROM_DOUBLE(a) eina_f32p32_double_from(a)
156#define FROM_INT(a) eina_f32p32_int_from(a) 156#define FROM_INT(a) eina_f32p32_int_from(a)
157#define TO_INT(a) eina_f32p32_int_to(a) 157#define TO_INT(a) eina_f32p32_int_to(a)
158#define TO_INT_ROUND(a) eina_f32p32_int_to(ADD(a, FROM_DOUBLE(0.5))) 158#define TO_INT_ROUND(a) (((a) >= 0.0) \
159 ? eina_f32p32_int_to(ADD(a, FROM_DOUBLE(0.5)) \
160 : eina_f32p32_int_to(ADD(a, FROM_DOUBLE(-0.5))
159#define ZERO 0 161#define ZERO 0
160#define COS(a) eina_f32p32_cos(a) 162#define COS(a) eina_f32p32_cos(a)
161#define SIN(a) eina_f32p32_sin(a) 163#define SIN(a) eina_f32p32_sin(a)
@@ -178,7 +180,7 @@ EAPI extern int _edje_default_log_dom ;
178#define FROM_DOUBLE(a) (a) 180#define FROM_DOUBLE(a) (a)
179#define FROM_INT(a) (double)(a) 181#define FROM_INT(a) (double)(a)
180#define TO_INT(a) (int)(a) 182#define TO_INT(a) (int)(a)
181#define TO_INT_ROUND(a) (int)(a + 0.5) 183#define TO_INT_ROUND(a) (((a) >= 0.0) ? (int)(a + 0.5) : (int)(a - 0.5))
182#define ZERO 0.0 184#define ZERO 0.0
183#define COS(a) cos(a) 185#define COS(a) cos(a)
184#define SIN(a) sin(a) 186#define SIN(a) sin(a)