summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-10-27 09:21:48 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-10-27 14:58:38 +0900
commitd5c882210744eafb75ebec057eadbedd748777fa (patch)
treef8756bc556020fb42dbe299ea85166c108a44d51 /src/lib/edje/edje_calc.c
parentad4e133e08cc9e9ab327efed58b5ca36b17156b5 (diff)
edje: use the file_set api from vg canvas to load and parse svg file.
Diffstat (limited to 'src/lib/edje/edje_calc.c')
-rw-r--r--src/lib/edje/edje_calc.c65
1 files changed, 25 insertions, 40 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index ba5b4742dc..0a9efdcfc9 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -1,5 +1,6 @@
1#define EFL_GFX_FILTER_BETA 1#define EFL_GFX_FILTER_BETA
2#define EFL_GFX_SIZE_HINT_PROTECTED 2#define EFL_GFX_SIZE_HINT_PROTECTED
3#define EVAS_VG_BETA
3 4
4#include "edje_private.h" 5#include "edje_private.h"
5 6
@@ -3693,63 +3694,47 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
3693static void 3694static void
3694_edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_UNUSED, Edje_Part_Description_Vector *chosen_desc, FLOAT_T pos) 3695_edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_UNUSED, Edje_Part_Description_Vector *chosen_desc, FLOAT_T pos)
3695{ 3696{
3697 int new_svg = -1; //invalid svg
3696 int w, h; 3698 int w, h;
3697 int new_svg = -1; 3699 char src_key[20], dest_key[20];
3698 Eina_Matrix3 matrix; 3700 Efl_VG *src_root, *dest_root, *root;
3699 Edje_Vector_Data *start, *end;
3700 3701
3701 evas_object_geometry_get(ep->object, NULL, NULL, &w, &h); 3702 evas_object_geometry_get(ep->object, NULL, NULL, &w, &h);
3702
3703 if( (w == 0) || (h == 0)) return; 3703 if( (w == 0) || (h == 0)) return;
3704 3704
3705 sprintf(src_key, "edje/vectors/%i", chosen_desc->vg.id);
3706
3705 if (ep->param2) 3707 if (ep->param2)
3706 { 3708 {
3707 Edje_Part_Description_Vector *next_state = (Edje_Part_Description_Vector *)ep->param2->description; 3709 Edje_Part_Description_Vector *next_state = (Edje_Part_Description_Vector *)ep->param2->description;
3708 if (chosen_desc->vg.id != next_state->vg.id) 3710 if (chosen_desc->vg.id != next_state->vg.id)
3709 { 3711 new_svg = next_state->vg.id;
3710 new_svg = next_state->vg.id; 3712 else
3711 } 3713 pos = 0;
3712 } 3714 }
3713 if (new_svg >= 0) // animation with svg id change 3715
3716 if (new_svg < 0)
3714 { 3717 {
3715 start = _edje_ref_vector_data(ed, chosen_desc->vg.id); 3718 efl_file_set(ep->object, ed->file->path, src_key);
3716 end = _edje_ref_vector_data(ed, new_svg); 3719 }
3720 else
3721 {
3722 sprintf(dest_key, "edje/vectors/%i", new_svg);
3723
3724 efl_file_set(ep->object, ed->file->path, src_key);
3725 src_root = efl_canvas_vg_root_node_get(ep->object);
3717 3726
3718 // for start vector 3727 efl_file_set(ep->object, ed->file->path, dest_key);
3719 _apply_transformation(start->vg, w, h, start); 3728 dest_root = efl_canvas_vg_root_node_get(ep->object);
3720 3729
3721 // for end vector 3730 root = evas_vg_container_add(NULL);
3722 _apply_transformation(end->vg, w, h, end); 3731 evas_vg_node_dup(root, src_root);
3723 3732
3724 // do the interpolation 3733 if (!evas_vg_node_interpolate(root, src_root, dest_root, pos))
3725 if (!evas_vg_node_interpolate(ep->typedata.vector->cur.vg, start->vg, end->vg, pos))
3726 { 3734 {
3727 ERR(" Can't interpolate check the svg file \n"); 3735 ERR(" Can't interpolate check the svg file \n");
3728 } 3736 }
3729 // performance hack 3737 efl_canvas_vg_root_node_set(ep->object, root);
3730 // instead of duplicating the tree and applying the transformation
3731 // i just updated the transformation matrix and reset it back to null.
3732 // assumption is that the root vg will never have a transformation
3733 eina_matrix3_identity(&matrix);
3734 evas_vg_node_transformation_set(start->vg, &matrix);
3735 evas_vg_node_transformation_set(end->vg, &matrix);
3736 }
3737 else
3738 {
3739 if (ep->typedata.vector->cur.svg_id == chosen_desc->vg.id) // no svg file change
3740 {
3741 _apply_transformation(ep->typedata.vector->cur.vg, w, h, &ep->typedata.vector->cur);
3742 return;
3743 }
3744 else
3745 {
3746 if (ep->typedata.vector->cur.vg)
3747 efl_del(ep->typedata.vector->cur.vg);
3748
3749 _edje_dupe_vector_data(ed, chosen_desc->vg.id, w, h, &ep->typedata.vector->cur);
3750
3751 evas_object_vg_root_node_set(ep->object, ep->typedata.vector->cur.vg);
3752 }
3753 } 3738 }
3754} 3739}
3755 3740