From: Vitalii Vorobiov Date: Mon, 6 Jun 2016 17:46:14 +0000 (+0300) Subject: edje_edit: fix map API (light, perspective, rotation) X-Git-Tag: accepted/tizen/common/20160804.174451~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F56%2F82056%2F2;p=platform%2Fupstream%2Fefl.git edje_edit: fix map API (light, perspective, rotation) it should be possible to set light or perspective to NULL and return -1 when nothing is set also ability to send NULL point to store rotation @fix Change-Id: If949b472a19f9a56d12b93fd2bb8a3e86ab904ef --- diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 16bffca..31a968a 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -7606,7 +7606,9 @@ edje_edit_state_map_light_get(Evas_Object *obj, const char *part, const char *st GET_PD_OR_RETURN(NULL); - erl = ed->table_parts[pd->map.id_light % ed->table_parts_size]; + if (pd->map.id_light == -1) return NULL; + + erl = ed->table_parts[pd->map.id_light]; if (erl->part->name) return eina_stringshare_add(erl->part->name); @@ -7620,7 +7622,9 @@ edje_edit_state_map_rotation_center_get(Evas_Object *obj, const char *part, cons GET_PD_OR_RETURN(NULL); - erl = ed->table_parts[pd->map.rot.id_center % ed->table_parts_size]; + if (pd->map.rot.id_center == -1) return NULL; + + erl = ed->table_parts[pd->map.rot.id_center]; if (erl->part->name) return eina_stringshare_add(erl->part->name); @@ -7721,9 +7725,9 @@ edje_edit_state_map_rotation_get(Evas_Object *obj, const char *part, const char { GET_PD_OR_RETURN(EINA_FALSE); - *x = TO_DOUBLE(pd->map.rot.x); - *y = TO_DOUBLE(pd->map.rot.y); - *z = TO_DOUBLE(pd->map.rot.z); + if (x) *x = TO_DOUBLE(pd->map.rot.x); + if (y) *y = TO_DOUBLE(pd->map.rot.y); + if (z) *z = TO_DOUBLE(pd->map.rot.z); return EINA_TRUE; } @@ -7769,10 +7773,14 @@ edje_edit_state_map_perspective_focal_get(Evas_Object *obj, const char *part, co EAPI Eina_Bool edje_edit_state_map_light_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part) { - if (!source_part) return EINA_FALSE; + int src_id = -1; + GET_PD_OR_RETURN(EINA_FALSE); - pd->map.id_light = _edje_part_id_find(ed, source_part); + if (source_part) + src_id = _edje_part_id_find(ed, source_part); + + pd->map.id_light = src_id; edje_object_calc_force(obj); return EINA_TRUE; @@ -7781,10 +7789,14 @@ edje_edit_state_map_light_set(Evas_Object *obj, const char *part, const char *st EAPI Eina_Bool edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part) { - if (!source_part) return EINA_FALSE; + int src_id = -1; + GET_PD_OR_RETURN(EINA_FALSE); - pd->map.rot.id_center = _edje_part_id_find(ed, source_part); + if (source_part) + src_id = _edje_part_id_find(ed, source_part); + + pd->map.rot.id_center = src_id; edje_object_calc_force(obj); return EINA_TRUE; @@ -7881,7 +7893,9 @@ edje_edit_state_map_perspective_get(Evas_Object *obj, const char *part, const ch GET_PD_OR_RETURN(NULL); - erl = ed->table_parts[pd->map.id_persp % ed->table_parts_size]; + if (pd->map.id_persp == -1) return NULL; + + erl = ed->table_parts[pd->map.id_persp]; if (erl->part->name) return eina_stringshare_add(erl->part->name); @@ -7891,12 +7905,13 @@ edje_edit_state_map_perspective_get(Evas_Object *obj, const char *part, const ch EAPI Eina_Bool edje_edit_state_map_perspective_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part) { - int src_id; + int src_id = -1; - if (!source_part) return EINA_FALSE; GET_PD_OR_RETURN(EINA_FALSE); - src_id = _edje_part_id_find(ed, source_part); + if (source_part) + src_id = _edje_part_id_find(ed, source_part); + pd->map.id_persp = src_id; edje_object_calc_force(obj);