evas vg: stabilize thorvg integration. 41/255341/1
authorHermet Park <chuneon.park@samsung.com>
Wed, 17 Mar 2021 06:24:47 +0000 (15:24 +0900)
committerHermet Park <chuneon.park@samsung.com>
Wed, 17 Mar 2021 06:24:47 +0000 (15:24 +0900)
there are missing start point while interpreting svg path,
after move the point the its position has to be relative to the previous shape
origin.

This patch make it work successfully.

Change-Id: Ie617f560424fecd66e89b1e71b4c797fa8bddfac

src/lib/evas/canvas/efl_canvas_vg_shape.c
src/lib/evas/canvas/evas_tvg_path_helpers.h

index 9f575c8..b13a0cc 100644 (file)
@@ -1536,6 +1536,7 @@ evas_vg_shape_append_svg_path(Evas_Vg_Shape *obj, const char *svg_path_data)
    int number_count = 0;
    double cur_x = 0, cur_y = 0;
    double cur_ctl_x = 0, cur_ctl_y = 0;
+   double start_x = 0, start_y = 0;
 
    char pth_cmd = 0;
    Eina_Bool is_quadratic = EINA_FALSE;
@@ -1550,7 +1551,7 @@ evas_vg_shape_append_svg_path(Evas_Vg_Shape *obj, const char *svg_path_data)
         if (!path) break;
         _process_command(&svg_path, pth_cmd, number_array,
                          &number_count, &cur_x, &cur_y,
-                         &cur_ctl_x, &cur_ctl_y, &is_quadratic);
+                         &cur_ctl_x, &cur_ctl_y, &start_x, &start_y, &is_quadratic);
      }
 
    tvg_shape_append_path(sd->shape, svg_path.cmds, svg_path.cmds_cnt, svg_path.pts, svg_path.pts_cnt);
index 5497b15..f3586f1 100644 (file)
@@ -325,7 +325,9 @@ _svg_path_grow(Efl_Tvg_Shape_Svg_Path *svg_path, int command_length)
 static void
 _process_command(Efl_Tvg_Shape_Svg_Path *svg_path, char c, double *pts,
                  int *number_array, double *cur_x, double *cur_y,
-                 double *cur_ctl_x, double *cur_ctl_y, Eina_Bool *is_quadratic)
+                 double *cur_ctl_x, double *cur_ctl_y,
+                 double *start_x, double *start_y,
+                 Eina_Bool *is_quadratic)
 {
    int i = 0;
    switch (c)
@@ -373,8 +375,8 @@ _process_command(Efl_Tvg_Shape_Svg_Path *svg_path, char c, double *pts,
            svg_path->pts[svg_path->pts_cnt-1].x = pts[0];
            svg_path->pts[svg_path->pts_cnt-1].y = pts[1];
            svg_path->cmds[svg_path->cmds_cnt-1] = TVG_PATH_COMMAND_MOVE_TO;
-           *cur_x = pts[0];
-           *cur_y = pts[1];
+           *start_x = *cur_x = pts[0];
+           *start_y = *cur_y = pts[1];
            break;
         }
       case 'l':
@@ -597,6 +599,8 @@ _process_command(Efl_Tvg_Shape_Svg_Path *svg_path, char c, double *pts,
         {
            if (!_svg_path_grow(svg_path, 0)) break;
            svg_path->cmds[svg_path->cmds_cnt-1] = TVG_PATH_COMMAND_CLOSE;
+           *cur_x = *start_x;
+           *cur_y = *start_y;
            break;
         }
       default: