summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2020-03-10 15:42:12 +0900
committerHermet Park <chuneon.park@samsung.com>2020-03-10 15:42:13 +0900
commit107e425ef62ebb5cd9b2d6e7feff0d26bd35f6e5 (patch)
tree4d7ec15c140c7217217b3fd7a557da84a5eb94bf
parent794792aacbbf0f693ef9178cb71db16547214ff8 (diff)
edje: Rename Json to Lottie in edj supporting
Summary: The json file used by edje is for lottie output. json can be used in many ways. So the purpose is clear. Test Plan: N/A Reviewers: Hermet, kimcinoo, herb Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11478
-rw-r--r--src/bin/edje/edje_cc_handlers.c2
-rw-r--r--src/bin/edje/edje_cc_out.c14
-rw-r--r--src/lib/edje/edje_calc.c36
-rw-r--r--src/lib/edje/edje_load.c8
-rw-r--r--src/lib/edje/edje_private.h6
5 files changed, 33 insertions, 33 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 22c621f1e8..431dea7bdb 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -2629,7 +2629,7 @@ st_images_vector(void)
2629 entry_len = strlen(vector->entry); 2629 entry_len = strlen(vector->entry);
2630 if ((entry_len > 5) && !strncmp(vector->entry + entry_len - 5, ".json", 5)) 2630 if ((entry_len > 5) && !strncmp(vector->entry + entry_len - 5, ".json", 5))
2631 { 2631 {
2632 vector->type = EDJE_VECTOR_FILE_TYPE_JSON; 2632 vector->type = EDJE_VECTOR_FILE_TYPE_LOTTIE;
2633 } 2633 }
2634 else 2634 else
2635 { 2635 {
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 4c192efe6e..af093b4d08 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -1428,22 +1428,22 @@ data_write_vectors(Eet_File *ef, int *vector_num)
1428 if (!f) continue; 1428 if (!f) continue;
1429 eina_file_close(f); 1429 eina_file_close(f);
1430 1430
1431 if (vector->type == EDJE_VECTOR_FILE_TYPE_JSON) 1431 if (vector->type == EDJE_VECTOR_FILE_TYPE_LOTTIE)
1432 { 1432 {
1433 char *json_data = NULL; 1433 char *lottie_data = NULL;
1434 int json_data_len = 0; 1434 int lottie_data_len = 0;
1435 1435
1436 f = eina_file_open(eina_strbuf_string_get(buf), EINA_FALSE); 1436 f = eina_file_open(eina_strbuf_string_get(buf), EINA_FALSE);
1437 if (!f) continue; 1437 if (!f) continue;
1438 1438
1439 json_data_len = (int) eina_file_size_get(f); 1439 lottie_data_len = (int) eina_file_size_get(f);
1440 json_data = eina_file_map_all(f, EINA_FILE_POPULATE); 1440 lottie_data = eina_file_map_all(f, EINA_FILE_POPULATE);
1441 1441
1442 eina_strbuf_reset(buf); 1442 eina_strbuf_reset(buf);
1443 eina_strbuf_append_printf(buf, "edje/vectors/%i", vector->id); 1443 eina_strbuf_append_printf(buf, "edje/vectors/%i", vector->id);
1444 eet_write(ef, eina_strbuf_string_get(buf), json_data, json_data_len, EET_COMPRESSION_NONE); 1444 eet_write(ef, eina_strbuf_string_get(buf), lottie_data, lottie_data_len, EET_COMPRESSION_NONE);
1445 1445
1446 eina_file_map_free(f, json_data); 1446 eina_file_map_free(f, lottie_data);
1447 eina_file_close(f); 1447 eina_file_close(f);
1448 1448
1449 *vector_num += 1; 1449 *vector_num += 1;
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 7de6c66db6..f3dd13be85 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -3319,13 +3319,13 @@ _edje_vector_animation_running_cb(void *data, const Efl_Event *event)
3319} 3319}
3320 3320
3321static void 3321static void
3322_edje_vector_load_json(Edje *ed, Edje_Real_Part *ep, const char *key) 3322_edje_vector_load_lottie(Edje *ed, Edje_Real_Part *ep, const char *key)
3323{ 3323{
3324 Edje_Part_Description_Vector *desc = (Edje_Part_Description_Vector *)ep->chosen_description; 3324 Edje_Part_Description_Vector *desc = (Edje_Part_Description_Vector *)ep->chosen_description;
3325 Eina_File *file; 3325 Eina_File *file;
3326 char *json_data; 3326 char *lottie_data;
3327 double frame_duration; 3327 double frame_duration;
3328 int json_data_len = 0; 3328 int lottie_data_len = 0;
3329 int frame_count; 3329 int frame_count;
3330 3330
3331 if (ep->typedata.vector->anim == NULL) 3331 if (ep->typedata.vector->anim == NULL)
@@ -3339,18 +3339,18 @@ _edje_vector_load_json(Edje *ed, Edje_Real_Part *ep, const char *key)
3339 3339
3340 if (ep->typedata.vector->current_id != desc->vg.id) 3340 if (ep->typedata.vector->current_id != desc->vg.id)
3341 { 3341 {
3342 json_data = (char *)eet_read(ed->file->ef, key, &json_data_len); 3342 lottie_data = (char *)eet_read(ed->file->ef, key, &lottie_data_len);
3343 json_data[json_data_len] = '\0'; 3343 lottie_data[lottie_data_len] = '\0';
3344 file = eina_file_virtualize(NULL, json_data, json_data_len + 1, EINA_FALSE); 3344 file = eina_file_virtualize(NULL, lottie_data, lottie_data_len + 1, EINA_FALSE);
3345 efl_file_simple_mmap_load(ep->object, file, NULL); 3345 efl_file_simple_mmap_load(ep->object, file, NULL);
3346 3346
3347 if (ep->typedata.vector->json_virtual_file) 3347 if (ep->typedata.vector->lottie_virtual_file)
3348 eina_file_close(ep->typedata.vector->json_virtual_file); 3348 eina_file_close(ep->typedata.vector->lottie_virtual_file);
3349 ep->typedata.vector->json_virtual_file = file; 3349 ep->typedata.vector->lottie_virtual_file = file;
3350 3350
3351 if (ep->typedata.vector->json_data) 3351 if (ep->typedata.vector->lottie_data)
3352 free(ep->typedata.vector->json_data); 3352 free(ep->typedata.vector->lottie_data);
3353 ep->typedata.vector->json_data = json_data; 3353 ep->typedata.vector->lottie_data = lottie_data;
3354 3354
3355 ep->typedata.vector->current_id = desc->vg.id; 3355 ep->typedata.vector->current_id = desc->vg.id;
3356 } 3356 }
@@ -3381,12 +3381,12 @@ _edje_vector_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EIN
3381 3381
3382 snprintf(src_key, sizeof(src_key), "edje/vectors/%i", chosen_desc->vg.id); 3382 snprintf(src_key, sizeof(src_key), "edje/vectors/%i", chosen_desc->vg.id);
3383 3383
3384 if (type == EDJE_VECTOR_FILE_TYPE_JSON) 3384 if (type == EDJE_VECTOR_FILE_TYPE_LOTTIE)
3385 { 3385 {
3386#ifdef BUILD_VG_LOADER_JSON 3386#ifdef BUILD_VG_LOADER_JSON
3387 _edje_vector_load_json(ed, ep, src_key); 3387 _edje_vector_load_lottie(ed, ep, src_key);
3388#else 3388#else
3389 ERR("Evas Vg Json (Lottie) Loader is not supported, Only Static Vector Image(SVG) is available!"); 3389 ERR("Evas Vg Lottie (Lottie) Loader is not supported, Only Static Vector Image(SVG) is available!");
3390#endif 3390#endif
3391 return; 3391 return;
3392 } 3392 }
@@ -3405,11 +3405,11 @@ _edje_vector_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EIN
3405 } 3405 }
3406 } 3406 }
3407 3407
3408 if ((new_id < 0) || (new_type == EDJE_VECTOR_FILE_TYPE_JSON)) 3408 if ((new_id < 0) || (new_type == EDJE_VECTOR_FILE_TYPE_LOTTIE))
3409 { 3409 {
3410#ifndef BUILD_VG_LOADER_JSON 3410#ifndef BUILD_VG_LOADER_JSON
3411 if (new_type == EDJE_VECTOR_FILE_TYPE_JSON) 3411 if (new_type == EDJE_VECTOR_FILE_TYPE_LOTTIE)
3412 ERR("Evas Vg Json (Lottie) Loader is not supported, Only Static Vector Image(SVG) is available!"); 3412 ERR("Evas Vg Lottie (Lottie) Loader is not supported, Only Static Vector Image(SVG) is available!");
3413 else 3413 else
3414#endif 3414#endif
3415 efl_file_simple_load(ep->object, ed->file->path, src_key); 3415 efl_file_simple_load(ep->object, ed->file->path, src_key);
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 553d989a81..aa894015c3 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -2036,10 +2036,10 @@ _edje_file_del(Edje *ed)
2036 { 2036 {
2037 if (rp->typedata.vector->anim) 2037 if (rp->typedata.vector->anim)
2038 efl_del(rp->typedata.vector->anim); 2038 efl_del(rp->typedata.vector->anim);
2039 if (rp->typedata.vector->json_virtual_file) 2039 if (rp->typedata.vector->lottie_virtual_file)
2040 eina_file_close(rp->typedata.vector->json_virtual_file); 2040 eina_file_close(rp->typedata.vector->lottie_virtual_file);
2041 if (rp->typedata.vector->json_data) 2041 if (rp->typedata.vector->lottie_data)
2042 free(rp->typedata.vector->json_data); 2042 free(rp->typedata.vector->lottie_data);
2043 2043
2044 free(rp->typedata.vector); 2044 free(rp->typedata.vector);
2045 rp->typedata.vector = NULL; 2045 rp->typedata.vector = NULL;
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index e38d6d57c5..f55e41fc77 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -690,7 +690,7 @@ struct _Edje_Image_Directory
690typedef enum _Edje_Vector_File_Type 690typedef enum _Edje_Vector_File_Type
691{ 691{
692 EDJE_VECTOR_FILE_TYPE_SVG = 0, 692 EDJE_VECTOR_FILE_TYPE_SVG = 0,
693 EDJE_VECTOR_FILE_TYPE_JSON 693 EDJE_VECTOR_FILE_TYPE_LOTTIE
694} Edje_Vector_File_Type; 694} Edje_Vector_File_Type;
695 695
696struct _Edje_Vector_Directory_Entry 696struct _Edje_Vector_Directory_Entry
@@ -2050,8 +2050,8 @@ struct _Edje_Real_Part_Swallow
2050struct _Edje_Real_Part_Vector 2050struct _Edje_Real_Part_Vector
2051{ 2051{
2052 Eo *anim; 2052 Eo *anim;
2053 Eina_File *json_virtual_file; 2053 Eina_File *lottie_virtual_file;
2054 char *json_data; 2054 char *lottie_data;
2055 int start_frame; 2055 int start_frame;
2056 int current_id; 2056 int current_id;
2057 Eina_Bool backward : 1; 2057 Eina_Bool backward : 1;