summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2020-09-22 14:52:42 +0900
committerHermet Park <chuneon.park@samsung.com>2020-09-22 14:52:42 +0900
commit0b5f658510362f03efa5e9cc8576de60e7287c7c (patch)
tree994ed212b9abdc30b32cb317c5f468c394e1c640
parent3aeffe0beca89a173dedbac28a2d0f853aac370f (diff)
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
-rw-r--r--src/lib/efl/interfaces/efl_gfx_path.c12
1 files 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)
1235} 1235}
1236 1236
1237static void 1237static void
1238process_command(Eo *obj, Efl_Gfx_Path_Data *pd, char cmd, double *arr, int count, double *cur_x, double *cur_y) 1238process_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)
1239{ 1239{
1240 int i; 1240 int i;
1241 switch (cmd) 1241 switch (cmd)
@@ -1282,6 +1282,8 @@ process_command(Eo *obj, Efl_Gfx_Path_Data *pd, char cmd, double *arr, int count
1282 _efl_gfx_path_append_move_to(obj, pd, arr[0], arr[1]); 1282 _efl_gfx_path_append_move_to(obj, pd, arr[0], arr[1]);
1283 *cur_x = arr[0]; 1283 *cur_x = arr[0];
1284 *cur_y = arr[1]; 1284 *cur_y = arr[1];
1285 *start_x = arr[0];
1286 *start_y = arr[1];
1285 break; 1287 break;
1286 } 1288 }
1287 case 'l': 1289 case 'l':
@@ -1342,6 +1344,8 @@ process_command(Eo *obj, Efl_Gfx_Path_Data *pd, char cmd, double *arr, int count
1342 case 'Z': 1344 case 'Z':
1343 { 1345 {
1344 _efl_gfx_path_append_close(obj, pd); 1346 _efl_gfx_path_append_close(obj, pd);
1347 *cur_x = *start_x;
1348 *cur_y = *start_y;
1345 break; 1349 break;
1346 } 1350 }
1347 case 'a': 1351 case 'a':
@@ -1420,6 +1424,7 @@ _path_interpolation(Eo *obj, Efl_Gfx_Path_Data *pd,
1420 double from_arr[7], to_arr[7]; 1424 double from_arr[7], to_arr[7];
1421 int from_count=0, to_count=0; 1425 int from_count=0, to_count=0;
1422 double cur_x=0, cur_y=0; 1426 double cur_x=0, cur_y=0;
1427 double start_x=0, start_y=0;
1423 char from_cmd= 0, to_cmd = 0; 1428 char from_cmd= 0, to_cmd = 0;
1424 char *cur_locale; 1429 char *cur_locale;
1425 1430
@@ -1458,7 +1463,7 @@ _path_interpolation(Eo *obj, Efl_Gfx_Path_Data *pd,
1458 from_arr[i] = interpolate(from_arr[i], to_arr[i], pos); 1463 from_arr[i] = interpolate(from_arr[i], to_arr[i], pos);
1459 } 1464 }
1460 } 1465 }
1461 process_command(obj, pd, from_cmd, from_arr, from_count, &cur_x, &cur_y); 1466 process_command(obj, pd, from_cmd, from_arr, from_count, &cur_x, &cur_y, &start_x, &start_y);
1462 } 1467 }
1463 else 1468 else
1464 { 1469 {
@@ -1479,6 +1484,7 @@ _efl_gfx_path_append_svg_path(Eo *obj, Efl_Gfx_Path_Data *pd,
1479 double number_array[7]; 1484 double number_array[7];
1480 int number_count = 0; 1485 int number_count = 0;
1481 double cur_x=0, cur_y=0; 1486 double cur_x=0, cur_y=0;
1487 double start_x=0, start_y=0;
1482 char cmd= 0; 1488 char cmd= 0;
1483 char *path = (char *) svg_path_data; 1489 char *path = (char *) svg_path_data;
1484 Eina_Bool arc = EINA_FALSE; 1490 Eina_Bool arc = EINA_FALSE;
@@ -1500,7 +1506,7 @@ _efl_gfx_path_append_svg_path(Eo *obj, Efl_Gfx_Path_Data *pd,
1500 //printf("Error parsing command\n"); 1506 //printf("Error parsing command\n");
1501 goto error; 1507 goto error;
1502 } 1508 }
1503 process_command(obj, pd, cmd, number_array, number_count, &cur_x, &cur_y); 1509 process_command(obj, pd, cmd, number_array, number_count, &cur_x, &cur_y, &start_x, &start_y);
1504 if ((!arc) && ((cmd == 'a') || (cmd == 'A') || 1510 if ((!arc) && ((cmd == 'a') || (cmd == 'A') ||
1505 (cmd == 'e') || (cmd == 'E'))) 1511 (cmd == 'e') || (cmd == 'E')))
1506 arc = EINA_TRUE; 1512 arc = EINA_TRUE;