From b71e2042500aaa6eb96bd5575a181f673ffef641 Mon Sep 17 00:00:00 2001 From: Michal Szczecinski Date: Wed, 4 Nov 2020 16:15:48 +0100 Subject: [PATCH] evas vector: Added path lenght get implementation for thorvg This commit is needed to use thorvg to render edje vector parts. Change-Id: I55f551e4f8865fd8af7f2487dd5897e6f2a1ea7a --- src/lib/evas/canvas/efl_canvas_vg_shape.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c index 398c563..68d17e0 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_shape.c +++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c @@ -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 -- 2.7.4