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