edje_calc: add rounding pixel calculation for transition. 99/91899/1
authorHosang Kim <hosang12.kim@samsung.com>
Tue, 11 Oct 2016 12:11:14 +0000 (21:11 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 12 Oct 2016 06:37:15 +0000 (15:37 +0900)
Summary: when transition animation is working, sometimes one pixels loss occurs.

Reviewers: cedric, woohyun, jpeg, raster

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4341
Change-Id: I4985ad1f65cb521b510732bac7ed8cc20ffdc011

src/lib/edje/edje_calc.c

index 033dc62..ff9ba66 100644 (file)
@@ -2539,6 +2539,61 @@ _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)
+{
+   /* 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 (!ed->calc_only)
+          {
+             params->final.w += 1;
+          }
+        else
+          {
+             ep->invalidate = EINA_TRUE;
+          }
+     }
+   else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w)))
+     {
+        if (!ed->calc_only)
+          {
+             params->final.w -= 1;
+          }
+        else
+          {
+             ep->invalidate = EINA_TRUE;
+          }
+     }
+   if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
+     {
+        if (!ed->calc_only)
+          {
+             params->final.h += 1;
+          }
+        else
+          {
+             ep->invalidate = EINA_TRUE;
+          }
+     }
+   else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
+     {
+        if (!ed->calc_only)
+          {
+             params->final.h -= 1;
+          }
+        else
+          {
+             ep->invalidate = EINA_TRUE;
+          }
+     }
+
+}
+
+static void
 _edje_part_recalc_single_filter(Edje *ed,
                                 Edje_Real_Part *ep,
                                 Edje_Part_Description_Common *desc,
@@ -2998,54 +3053,7 @@ _edje_part_recalc_single(Edje *ed,
    params->final.w = TO_INT(params->eval.w);
    params->final.h = TO_INT(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 (!ed->calc_only)
-          {
-             params->final.w += 1;
-          }
-        else
-          {
-             ep->invalidate = EINA_TRUE;
-          }
-     }
-   else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w)))
-     {
-        if (!ed->calc_only)
-          {
-             params->final.w -= 1;
-          }
-        else
-          {
-             ep->invalidate = EINA_TRUE;
-          }
-     }
-   if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
-     {
-        if (!ed->calc_only)
-          {
-             params->final.h += 1;
-          }
-        else
-          {
-             ep->invalidate = EINA_TRUE;
-          }
-     }
-   else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
-     {
-        if (!ed->calc_only)
-          {
-             params->final.h -= 1;
-          }
-        else
-          {
-             ep->invalidate = EINA_TRUE;
-          }
-     }
-
+   _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);
@@ -4518,6 +4526,8 @@ _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);
+
         if (ep->part->dragable.x)
           {
              p3->req_drag.x = INTP(p1->req_drag.x, p2->req_drag.x, pos);