summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-10-12 10:28:36 +0300
committerCedric BAIL <cedric@osg.samsung.com>2017-11-10 10:29:39 -0800
commit20ecea1615e484b18a651fc4983b99abb85146eb (patch)
tree05dc5a600aff48862b380a6f55e86665762a10f8 /src
parenta80209a59eefe1a77f630c111a00a512c492825a (diff)
Canvas text: fix applying effects
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 251d1add48..7d91e68770 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -15581,14 +15581,45 @@ static const struct
15581 { EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT }, 15581 { EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT },
15582}; 15582};
15583 15583
15584#define MAP_LEN(a) ((sizeof (a)) / sizeof((a)[0]))
15585
15586static Evas_Text_Style_Type
15587_get_style_from_map(Efl_Text_Style_Effect_Type st)
15588{
15589 size_t i;
15590 size_t len = MAP_LEN(_map_style_effect);
15591 for (i = 0; i < len; i++)
15592 {
15593 if (_map_style_effect[i].x == st)
15594 return _map_style_effect[i].y;
15595 }
15596 ERR("Mapping style failed. Please check code\n");
15597 return EVAS_TEXT_STYLE_SHADOW; // shouldn't reach
15598}
15599
15600static Evas_Text_Style_Type
15601_get_dir_from_map(Efl_Text_Style_Shadow_Direction dir)
15602{
15603 size_t i;
15604 size_t len = MAP_LEN(_map_shadow_dir);
15605 for (i = 0; i < len; i++)
15606 {
15607 if (_map_shadow_dir[i].x == dir)
15608 return _map_shadow_dir[i].y;
15609 }
15610 ERR("Mapping direction failed. Please check code\n");
15611 return EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT; // shouldn't reach
15612}
15613
15584static void 15614static void
15585_efl_canvas_text_efl_text_style_effect_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Effect_Type type EINA_UNUSED) 15615_efl_canvas_text_efl_text_style_effect_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Effect_Type type EINA_UNUSED)
15586{ 15616{
15587 ASYNC_BLOCK; 15617 ASYNC_BLOCK;
15588 _FMT_INFO_SET_START(effect, type); 15618 _FMT_INFO_SET_START(effect, type);
15589 _FMT(style) = _map_style_effect[type].y; 15619 _FMT(style) = _get_style_from_map(type);
15590 // Re-apply shadow direction 15620 // Re-apply shadow direction
15591 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), _map_shadow_dir[type].y); 15621 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style),
15622 _get_dir_from_map(_FMT_INFO(shadow_direction)));
15592 _FMT_INFO_SET_END(); 15623 _FMT_INFO_SET_END();
15593} 15624}
15594 15625
@@ -15616,7 +15647,8 @@ _efl_canvas_text_efl_text_style_shadow_direction_set(Eo *obj EINA_UNUSED, Efl_Ca
15616{ 15647{
15617 ASYNC_BLOCK; 15648 ASYNC_BLOCK;
15618 _FMT_INFO_SET_START(shadow_direction, type); 15649 _FMT_INFO_SET_START(shadow_direction, type);
15619 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), _map_shadow_dir[type].y); 15650 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style),
15651 _get_dir_from_map(_FMT_INFO(shadow_direction)));
15620 _FMT_INFO_SET_END(); 15652 _FMT_INFO_SET_END();
15621} 15653}
15622 15654