textpath: reduces differences between actual position and modified position 81/182981/2 accepted/tizen/4.0/unified/20180706.091431 submit/tizen_4.0/20180705.082454
authorYoungbok Shin <youngb.shin@samsung.com>
Fri, 29 Jun 2018 09:31:35 +0000 (18:31 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Mon, 2 Jul 2018 10:26:38 +0000 (10:26 +0000)
@tizen_fix

Change-Id: Ic6fa6b8e196c25054929e25575b47d4fc953275d

src/lib/efl_ui_textpath.c

index d145a0a..08b3e94 100644 (file)
@@ -178,7 +178,9 @@ _segment_draw(Efl_Ui_Textpath_Data *pd, int slice_no, double dt, double dist,
         vec2.y = (-vec.y + py);
 
         /* Set mp1, mp2 position according to difference between previous points and next points.
-         * It improves smoothness of curve's slope changing. */
+         * It improves smoothness of curve's slope changing. It can show smooth result.
+         * But, it can cause huge differeces from actual positions.
+         * */
         mp0_x = *last_x1;
         mp0_y = *last_y1;
         mp1_x = *last_x1 + (int) floor(vec1.x - vec0.x + 0.5);
@@ -188,6 +190,12 @@ _segment_draw(Efl_Ui_Textpath_Data *pd, int slice_no, double dt, double dist,
         mp3_x = *last_x2;
         mp3_y = *last_y2;
 
+        /* It reduces differences between actual position and modified position. */
+        mp1_x += (int)floor(((double)vec1.x - mp1_x) / 2 + 0.5);
+        mp1_y += (int)floor(((double)vec1.y - mp1_y) / 2 + 0.5);
+        mp2_x += (int)floor(((double)vec2.x - mp2_x) / 2 + 0.5);
+        mp2_y += (int)floor(((double)vec2.y - mp2_y) / 2 + 0.5);
+
         evas_map_point_coord_set(map, cmp + i * 4, mp0_x, mp0_y, 0);
         evas_map_point_coord_set(map, cmp + i * 4 + 1, mp1_x, mp1_y, 0);
         evas_map_point_coord_set(map, cmp + i * 4 + 2, mp2_x, mp2_y, 0);