From: Mira Grudzinska Date: Tue, 23 Mar 2021 13:11:53 +0000 (+0100) Subject: evas vg: integration of join and cap properties in evas with ThorVG X-Git-Tag: accepted/tizen/unified/20210330.111316~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e818838baaad53a5b57fe0198746f3f155a6da37;p=platform%2Fupstream%2Fefl.git evas vg: integration of join and cap properties in evas with ThorVG Join and cap stroke properties had to translated from Efl values to Tvg values and vice versa. Change-Id: Id98c3e7fc6b314b1527160e004c29595cac21c88 --- diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c index f314c83..1569e7f 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_shape.c +++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c @@ -1034,7 +1034,7 @@ evas_vg_shape_stroke_cap_get(Evas_Vg_Shape *obj) #ifdef HAVE_THORVG Tvg_Stroke_Cap cap; tvg_shape_get_stroke_cap(_get_tvg_shape(obj), &cap); - return (Evas_Vg_Cap)cap; + return _tvg_to_efl_stroke_cap(cap); #else return (Evas_Vg_Cap)efl_gfx_shape_stroke_cap_get(obj); #endif @@ -1044,7 +1044,7 @@ EAPI void evas_vg_shape_stroke_cap_set(Evas_Vg_Shape *obj, Evas_Vg_Cap c) { #ifdef HAVE_THORVG - tvg_shape_set_stroke_cap(_get_tvg_shape(obj), (Tvg_Stroke_Cap) c); + tvg_shape_set_stroke_cap(_get_tvg_shape(obj), _efl_to_tvg_stroke_cap(c)); #else efl_gfx_shape_stroke_cap_set(obj, (Efl_Gfx_Cap)c); #endif @@ -1057,7 +1057,7 @@ evas_vg_shape_stroke_join_get(Evas_Vg_Shape *obj) #ifdef HAVE_THORVG Tvg_Stroke_Join join; tvg_shape_get_stroke_join(_get_tvg_shape(obj), &join); - return (Evas_Vg_Join)join; + return _tvg_to_efl_stroke_join(join); #else return (Evas_Vg_Join)efl_gfx_shape_stroke_join_get(obj); #endif @@ -1067,7 +1067,7 @@ EAPI void evas_vg_shape_stroke_join_set(Evas_Vg_Shape *obj, Evas_Vg_Join j) { #ifdef HAVE_THORVG - tvg_shape_set_stroke_join(_get_tvg_shape(obj), (Tvg_Stroke_Join) j); + tvg_shape_set_stroke_join(_get_tvg_shape(obj), _efl_to_tvg_stroke_join(j)); #else efl_gfx_shape_stroke_join_set(obj, (Efl_Gfx_Join)j); #endif diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h index ae27786..baf7528 100644 --- a/src/lib/evas/canvas/evas_vg_private.h +++ b/src/lib/evas/canvas/evas_vg_private.h @@ -198,6 +198,54 @@ _convert_eina_to_tvg_mat(const Eina_Matrix3 *eina_mat, Tvg_Matrix *tvg_mat) tvg_mat->e32 = eina_mat->zy; tvg_mat->e33 = eina_mat->zz; } + +static inline Tvg_Stroke_Join +_efl_to_tvg_stroke_join(Evas_Vg_Join join) +{ + switch (join) + { + case EFL_GFX_JOIN_MITER: return TVG_STROKE_JOIN_MITER; + case EFL_GFX_JOIN_ROUND: return TVG_STROKE_JOIN_ROUND; + case EFL_GFX_JOIN_BEVEL: return TVG_STROKE_JOIN_BEVEL; + default: return TVG_STROKE_JOIN_MITER; + } +} + +static inline Evas_Vg_Join +_tvg_to_efl_stroke_join(Tvg_Stroke_Join join) +{ + switch (join) + { + case TVG_STROKE_JOIN_MITER: return EFL_GFX_JOIN_MITER; + case TVG_STROKE_JOIN_ROUND: return EFL_GFX_JOIN_ROUND; + case TVG_STROKE_JOIN_BEVEL: return EFL_GFX_JOIN_BEVEL; + default: return EFL_GFX_JOIN_MITER; + } +} + +static inline Tvg_Stroke_Cap +_efl_to_tvg_stroke_cap(Evas_Vg_Cap cap) +{ + switch (cap) + { + case EFL_GFX_CAP_SQUARE: return TVG_STROKE_CAP_SQUARE; + case EFL_GFX_CAP_ROUND: return TVG_STROKE_CAP_ROUND; + case EFL_GFX_CAP_BUTT: return TVG_STROKE_CAP_BUTT; + default: return TVG_STROKE_CAP_BUTT; + } +} + +static inline Evas_Vg_Cap +_tvg_to_efl_stroke_cap(Tvg_Stroke_Cap cap) +{ + switch (cap) + { + case TVG_STROKE_CAP_SQUARE: return EFL_GFX_CAP_SQUARE; + case TVG_STROKE_CAP_ROUND: return EFL_GFX_CAP_ROUND; + case TVG_STROKE_CAP_BUTT: return EFL_GFX_CAP_BUTT; + default: return EFL_GFX_CAP_BUTT; + } +} #endif static inline void