summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-10-12 10:28:36 +0300
committerDaniel Hirt <hirt.danny@gmail.com>2017-11-06 15:35:00 +0200
commit826623da0c4959e7a04c43dca50cc54a85c7b18b (patch)
tree131de9817186dde069508096ad1f09d815eb4ba7
parentb159dc156a0d6ffdae80074bf73c638c726057ca (diff)
Canvas text: fix applying effects
-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 45063b3951..ddb03461a7 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -15570,14 +15570,45 @@ static const struct
15570 { EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT }, 15570 { EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT },
15571}; 15571};
15572 15572
15573#define MAP_LEN(a) ((sizeof (a)) / sizeof((a)[0]))
15574
15575static Evas_Text_Style_Type
15576_get_style_from_map(Efl_Text_Style_Effect_Type st)
15577{
15578 size_t i;
15579 size_t len = MAP_LEN(_map_style_effect);
15580 for (i = 0; i < len; i++)
15581 {
15582 if (_map_style_effect[i].x == st)
15583 return _map_style_effect[i].y;
15584 }
15585 ERR("Mapping style failed. Please check code\n");
15586 return EVAS_TEXT_STYLE_SHADOW; // shouldn't reach
15587}
15588
15589static Evas_Text_Style_Type
15590_get_dir_from_map(Efl_Text_Style_Shadow_Direction dir)
15591{
15592 size_t i;
15593 size_t len = MAP_LEN(_map_shadow_dir);
15594 for (i = 0; i < len; i++)
15595 {
15596 if (_map_shadow_dir[i].x == dir)
15597 return _map_shadow_dir[i].y;
15598 }
15599 ERR("Mapping direction failed. Please check code\n");
15600 return EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT; // shouldn't reach
15601}
15602
15573static void 15603static void
15574_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) 15604_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)
15575{ 15605{
15576 ASYNC_BLOCK; 15606 ASYNC_BLOCK;
15577 _FMT_INFO_SET_START(effect, type); 15607 _FMT_INFO_SET_START(effect, type);
15578 _FMT(style) = _map_style_effect[type].y; 15608 _FMT(style) = _get_style_from_map(type);
15579 // Re-apply shadow direction 15609 // Re-apply shadow direction
15580 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), _map_shadow_dir[type].y); 15610 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style),
15611 _get_dir_from_map(_FMT_INFO(shadow_direction)));
15581 _FMT_INFO_SET_END(); 15612 _FMT_INFO_SET_END();
15582} 15613}
15583 15614
@@ -15605,7 +15636,8 @@ _efl_canvas_text_efl_text_style_shadow_direction_set(Eo *obj EINA_UNUSED, Efl_Ca
15605{ 15636{
15606 ASYNC_BLOCK; 15637 ASYNC_BLOCK;
15607 _FMT_INFO_SET_START(shadow_direction, type); 15638 _FMT_INFO_SET_START(shadow_direction, type);
15608 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), _map_shadow_dir[type].y); 15639 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style),
15640 _get_dir_from_map(_FMT_INFO(shadow_direction)));
15609 _FMT_INFO_SET_END(); 15641 _FMT_INFO_SET_END();
15610} 15642}
15611 15643