Revert "Revert "edje_calc: round the scaled value when it is casted to int type."" 98/110598/2
authorJaehwan Kim <jae.hwan.kim@samsung.com>
Tue, 17 Jan 2017 06:36:49 +0000 (15:36 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 17 Jan 2017 07:14:08 +0000 (23:14 -0800)
This reverts commit d941d18076a51ba6a7a4ec45461699dba22bd27b.

Change-Id: Ide96edcd224dd064e1fbb378f0910d4e07f77653

src/lib/edje/edje_calc.c
src/lib/edje/edje_private.h

index 722ee83..be7c6d6 100644 (file)
@@ -2626,7 +2626,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))
      {
@@ -2653,7 +2653,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;
                }
           }
@@ -2666,7 +2666,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)
@@ -2679,7 +2679,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;
           }
      }
@@ -2691,7 +2691,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))
      {
@@ -2718,7 +2718,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;
                }
           }
@@ -2731,7 +2731,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)
@@ -2744,7 +2744,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;
           }
      }
index 5b24ebf..1970d9a 100644 (file)
@@ -150,6 +150,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)
@@ -170,6 +171,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)