evas vector: Added path lenght get implementation for thorvg 76/246976/3
authorMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Wed, 4 Nov 2020 15:15:48 +0000 (16:15 +0100)
committerHermet Park <chuneon.park@samsung.com>
Mon, 9 Nov 2020 08:16:35 +0000 (08:16 +0000)
This commit is needed to use thorvg to render edje vector parts.

Change-Id: I55f551e4f8865fd8af7f2487dd5897e6f2a1ea7a

src/lib/evas/canvas/efl_canvas_vg_shape.c

index 398c563..68d17e0 100644 (file)
@@ -1036,8 +1036,26 @@ evas_vg_shape_path_get(Evas_Vg_Shape *obj, const Evas_Vg_Path_Command **op, cons
 EAPI void
 evas_vg_shape_path_length_get(Evas_Vg_Shape *obj, unsigned int *commands, unsigned int *points)
 {
-   //TODO: implement
+#ifdef HAVE_THORVG
+   Tvg_Paint *tvg_shape = _get_tvg_shape(obj);
+   if (!tvg_shape) return;
+
+   const Tvg_Path_Command *cmds = NULL;
+   const Tvg_Point *coords = NULL;
+
+   tvg_shape_get_path_commands(tvg_shape, &cmds, commands);
+   tvg_shape_get_path_coords(tvg_shape, &coords, points);
+
+   //in evas commands we have always EVAS_VG_PATH_COMMAND_END to indicate commands
+   //array end.
+   *commands += 1;
+
+   //evas array stores x, y coordinates in one array, tvg use array of points
+   *points = *points * 2;
+
+#else
    efl_gfx_path_length_get(obj, commands, points);
+#endif
 }
 
 EAPI void