summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-11-12 14:28:44 +0900
committerJunsuChoi <jsuya.choi@samsung.com>2019-11-12 14:28:44 +0900
commitddaa5d1e6e76e76cf836182ee392f8b464a243d4 (patch)
tree9cd05a19891af4ad158557b94970798370242f0d /src
parent97f58949720a6dd2b92b71e89179aaffc00e41bc (diff)
vg_loader: Get markers information form json data.
Summary: If json data has marker information, it is stored in vg file data. Test Plan: N/A Reviewers: Hermet, smohanty, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10504
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/include/evas_private.h9
-rw-r--r--src/modules/evas/vg_loaders/json/evas_vg_load_json.c24
2 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 2081c3d..838174a 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -141,6 +141,7 @@ typedef struct _Evas_Canvas3D_File_Eet Evas_Canvas3D_File_Eet;
141 141
142typedef struct _Vg_File_Data Vg_File_Data; 142typedef struct _Vg_File_Data Vg_File_Data;
143typedef struct _Vg_File_Anim_Data Vg_File_Anim_Data; 143typedef struct _Vg_File_Anim_Data Vg_File_Anim_Data;
144typedef struct _Vg_File_Anim_Data_Marker Vg_File_Anim_Data_Marker;
144 145
145struct _Evas_Canvas3D_Vec2_Eet 146struct _Evas_Canvas3D_Vec2_Eet
146{ 147{
@@ -1533,11 +1534,19 @@ struct _Evas_Image_Save_Func
1533 int (*image_save) (RGBA_Image *im, const char *file, const char *key, int quality, int compress, const char *encoding); 1534 int (*image_save) (RGBA_Image *im, const char *file, const char *key, int quality, int compress, const char *encoding);
1534}; 1535};
1535 1536
1537struct _Vg_File_Anim_Data_Marker
1538{
1539 Eina_Stringshare *name;
1540 int startframe;
1541 int endframe;
1542};
1543
1536struct _Vg_File_Anim_Data 1544struct _Vg_File_Anim_Data
1537{ 1545{
1538 unsigned int frame_num; //current frame number 1546 unsigned int frame_num; //current frame number
1539 unsigned int frame_cnt; //total frame count 1547 unsigned int frame_cnt; //total frame count
1540 float duration; //animation duration 1548 float duration; //animation duration
1549 Eina_Inarray *markers; //array of Vg_File_Anim_Data_Marker
1541}; 1550};
1542 1551
1543struct _Vg_File_Data 1552struct _Vg_File_Data
diff --git a/src/modules/evas/vg_loaders/json/evas_vg_load_json.c b/src/modules/evas/vg_loaders/json/evas_vg_load_json.c
index fbcfa9c..e7f2754 100644
--- a/src/modules/evas/vg_loaders/json/evas_vg_load_json.c
+++ b/src/modules/evas/vg_loaders/json/evas_vg_load_json.c
@@ -20,6 +20,13 @@ evas_vg_load_file_close_json(Vg_File_Data *vfd)
20 20
21 Lottie_Animation *lot_anim = (Lottie_Animation *) vfd->loader_data; 21 Lottie_Animation *lot_anim = (Lottie_Animation *) vfd->loader_data;
22 lottie_animation_destroy(lot_anim); 22 lottie_animation_destroy(lot_anim);
23 if (vfd->anim_data->markers)
24 {
25 Vg_File_Anim_Data_Marker *marker;
26 EINA_INARRAY_FOREACH(vfd->anim_data->markers, marker)
27 if (marker->name) eina_stringshare_del(marker->name);
28 eina_inarray_free(vfd->anim_data->markers);
29 }
23 if (vfd->anim_data) free(vfd->anim_data); 30 if (vfd->anim_data) free(vfd->anim_data);
24 if (vfd->root) efl_unref(vfd->root); 31 if (vfd->root) efl_unref(vfd->root);
25 free(vfd); 32 free(vfd);
@@ -70,6 +77,23 @@ evas_vg_load_file_open_json(Eina_File *file,
70 if (!vfd->anim_data) goto err; 77 if (!vfd->anim_data) goto err;
71 vfd->anim_data->duration = lottie_animation_get_duration(lot_anim); 78 vfd->anim_data->duration = lottie_animation_get_duration(lot_anim);
72 vfd->anim_data->frame_cnt = frame_cnt; 79 vfd->anim_data->frame_cnt = frame_cnt;
80
81 // marker information
82 const LOTMarkerList *markerlist = lottie_animation_get_markerlist(lot_anim);
83 if (markerlist && markerlist->size > 0)
84 {
85 Vg_File_Anim_Data_Marker *marker;
86 int i = 0;
87 vfd->anim_data->markers = eina_inarray_new(sizeof(Vg_File_Anim_Data_Marker), 0);
88 eina_inarray_resize(vfd->anim_data->markers, markerlist->size);
89 EINA_INARRAY_FOREACH(vfd->anim_data->markers, marker)
90 {
91 marker->name = eina_stringshare_add(markerlist->ptr[i].name);
92 marker->startframe = markerlist->ptr[i].startframe;
93 marker->endframe = markerlist->ptr[i].endframe;
94 i++;
95 }
96 }
73 } 97 }
74 98
75 //default size 99 //default size