hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0b5f658510362f03efa5e9cc8576de60e7287c7c

commit 0b5f658510362f03efa5e9cc8576de60e7287c7c
Author: JunsuChoi <jsuya.c...@samsung.com>
Date:   Tue Sep 22 14:52:42 2020 +0900

    efl_gfx_path: When path end(Z,z), Current point are returned to starting 
point(M,m)
    
    Summary:
    When path ends with 'z' or 'Z' command, if 'm' comes as next command,
    the current point is incorrectly referenced.
    Since 'Z', 'z' means to close the path,
    so, Save point and reuse it when 'M' or 'm' is called.
    
    Test Plan:
    [Error Case]
    <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg"; 
viewBox="0 0 64 64">
        <path d="M 52.17,20
                 H 11.92
                 V 43
                 H 52.17
                 Z
                 m -1.5,21.5
                 H 13.42
                 v -20
                 H 50.67
                 Z
    " fill="#a8b7c1" stroke="#F00" stroke-width="0.5" />
    </svg>
    
    Reviewers: Hermet, smohanty
    
    Reviewed By: Hermet
    
    Subscribers: cedric, herb, kimcinoo, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D12158
---
 src/lib/efl/interfaces/efl_gfx_path.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/lib/efl/interfaces/efl_gfx_path.c 
b/src/lib/efl/interfaces/efl_gfx_path.c
index df476921f2..4c20fb45b2 100644
--- a/src/lib/efl/interfaces/efl_gfx_path.c
+++ b/src/lib/efl/interfaces/efl_gfx_path.c
@@ -1235,7 +1235,7 @@ _number_count(char cmd)
 }
 
 static void
-process_command(Eo *obj, Efl_Gfx_Path_Data *pd, char cmd, double *arr, int 
count, double *cur_x, double *cur_y)
+process_command(Eo *obj, Efl_Gfx_Path_Data *pd, char cmd, double *arr, int 
count, double *cur_x, double *cur_y, double *start_x, double *start_y)
 {
    int i;
    switch (cmd)
@@ -1282,6 +1282,8 @@ process_command(Eo *obj, Efl_Gfx_Path_Data *pd, char cmd, 
double *arr, int count
            _efl_gfx_path_append_move_to(obj, pd, arr[0], arr[1]);
            *cur_x = arr[0];
            *cur_y = arr[1];
+           *start_x = arr[0];
+           *start_y = arr[1];
            break;
         }
       case 'l':
@@ -1342,6 +1344,8 @@ process_command(Eo *obj, Efl_Gfx_Path_Data *pd, char cmd, 
double *arr, int count
       case 'Z':
         {
            _efl_gfx_path_append_close(obj, pd);
+           *cur_x = *start_x;
+           *cur_y = *start_y;
            break;
         }
       case 'a':
@@ -1420,6 +1424,7 @@ _path_interpolation(Eo *obj, Efl_Gfx_Path_Data *pd,
    double from_arr[7], to_arr[7];
    int from_count=0, to_count=0;
    double cur_x=0, cur_y=0;
+   double start_x=0, start_y=0;
    char from_cmd= 0, to_cmd = 0;
    char *cur_locale;
 
@@ -1458,7 +1463,7 @@ _path_interpolation(Eo *obj, Efl_Gfx_Path_Data *pd,
                        from_arr[i] = interpolate(from_arr[i], to_arr[i], pos);
                     }
                }
-            process_command(obj, pd, from_cmd, from_arr, from_count, &cur_x, 
&cur_y);
+            process_command(obj, pd, from_cmd, from_arr, from_count, &cur_x, 
&cur_y, &start_x, &start_y);
           }
         else
           {
@@ -1479,6 +1484,7 @@ _efl_gfx_path_append_svg_path(Eo *obj, Efl_Gfx_Path_Data 
*pd,
    double number_array[7];
    int number_count = 0;
    double cur_x=0, cur_y=0;
+   double start_x=0, start_y=0;
    char cmd= 0;
    char *path = (char *) svg_path_data;
    Eina_Bool arc = EINA_FALSE;
@@ -1500,7 +1506,7 @@ _efl_gfx_path_append_svg_path(Eo *obj, Efl_Gfx_Path_Data 
*pd,
              //printf("Error parsing command\n");
              goto error;
           }
-        process_command(obj, pd, cmd, number_array, number_count, &cur_x, 
&cur_y);
+        process_command(obj, pd, cmd, number_array, number_count, &cur_x, 
&cur_y, &start_x, &start_y);
         if ((!arc) && ((cmd == 'a') || (cmd == 'A') ||
             (cmd == 'e') || (cmd == 'E')))
           arc = EINA_TRUE;

-- 


Reply via email to