summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-11-12 14:29:50 +0900
committerJunsuChoi <jsuya.choi@samsung.com>2019-11-12 14:29:50 +0900
commit93551ca58e8c5676b116d98eba07a8061c4ec8fd (patch)
tree02e71f5227d66a76223ce872c473522bb9a3d289
parentddaa5d1e6e76e76cf836182ee392f8b464a243d4 (diff)
evas_cache_vg : Implements sector_get/set internal APIs
Summary: These APIs to get and set frames for a specific section in vg animation. get API looks for a sector by name in the markerlist of VG_File_Data. Then return start and end frames. Depends on D10504 Test Plan: N/A Reviewers: Hermet, smohanty, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10505
-rw-r--r--src/lib/evas/canvas/evas_vg_private.h2
-rw-r--r--src/lib/evas/vg/evas_vg_cache.c52
2 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h
index 036604b..f5600f9 100644
--- a/src/lib/evas/canvas/evas_vg_private.h
+++ b/src/lib/evas/canvas/evas_vg_private.h
@@ -151,6 +151,8 @@ Vg_File_Data * evas_cache_vg_file_open(const Eina_File *file, const
151Eina_Bool evas_cache_vg_file_save(Efl_VG *root, int w, int h, const char *file, const char *key, const Efl_File_Save_Info *info); 151Eina_Bool evas_cache_vg_file_save(Efl_VG *root, int w, int h, const char *file, const char *key, const Efl_File_Save_Info *info);
152Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const Efl_File_Save_Info *info); 152Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const Efl_File_Save_Info *info);
153double evas_cache_vg_anim_duration_get(const Vg_Cache_Entry *vg_entry); 153double evas_cache_vg_anim_duration_get(const Vg_Cache_Entry *vg_entry);
154Eina_Bool evas_cache_vg_anim_sector_set(const Vg_Cache_Entry* vg_entry, const char *name, int startframe, int endframe);
155Eina_Bool evas_cache_vg_anim_sector_get(const Vg_Cache_Entry* vg_entry, const char *name, int* startframe, int* endframe);
154unsigned int evas_cache_vg_anim_frame_count_get(const Vg_Cache_Entry *vg_entry); 156unsigned int evas_cache_vg_anim_frame_count_get(const Vg_Cache_Entry *vg_entry);
155Eina_Size2D evas_cache_vg_entry_default_size_get(const Vg_Cache_Entry *vg_entry); 157Eina_Size2D evas_cache_vg_entry_default_size_get(const Vg_Cache_Entry *vg_entry);
156void efl_canvas_vg_node_vg_obj_set(Efl_VG *node, Efl_VG *vg_obj, Efl_Canvas_Vg_Object_Data *vd); 158void efl_canvas_vg_node_vg_obj_set(Efl_VG *node, Efl_VG *vg_obj, Efl_Canvas_Vg_Object_Data *vd);
diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c
index 391d3cb..8ffdfab 100644
--- a/src/lib/evas/vg/evas_vg_cache.c
+++ b/src/lib/evas/vg/evas_vg_cache.c
@@ -433,6 +433,58 @@ evas_cache_vg_anim_frame_count_get(const Vg_Cache_Entry* vg_entry)
433 return vfd->anim_data->frame_cnt; 433 return vfd->anim_data->frame_cnt;
434} 434}
435 435
436Eina_Bool
437evas_cache_vg_anim_sector_set(const Vg_Cache_Entry* vg_entry, const char *name, int startframe, int endframe)
438{
439 if (!vg_entry) return EINA_FALSE;
440 if (!vg_entry->vfd->anim_data) return EINA_FALSE;
441 if (!vg_entry->vfd->anim_data->markers) return EINA_FALSE;
442 if (!name) return EINA_FALSE;
443
444 Vg_File_Anim_Data_Marker *marker;
445 Vg_File_Anim_Data_Marker new_marker;
446 int i = 0;
447
448 EINA_INARRAY_FOREACH(vg_entry->vfd->anim_data->markers, marker)
449 {
450 if (!strcmp(marker->name, name))
451 {
452 marker->startframe = startframe;
453 marker->endframe = endframe;
454 return EINA_TRUE;
455 }
456 i++;
457 }
458
459 new_marker.name = eina_stringshare_add(name);
460 new_marker.startframe = startframe;
461 new_marker.endframe = endframe;
462 eina_inarray_push(vg_entry->vfd->anim_data->markers, &new_marker);
463
464 return EINA_TRUE;
465}
466
467Eina_Bool
468evas_cache_vg_anim_sector_get(const Vg_Cache_Entry* vg_entry, const char *name, int* startframe, int* endframe)
469{
470 if (!vg_entry) return EINA_FALSE;
471 if (!vg_entry->vfd->anim_data) return EINA_FALSE;
472 if (!vg_entry->vfd->anim_data->markers) return EINA_FALSE;
473 if (!name) return EINA_FALSE;
474
475 Vg_File_Anim_Data_Marker *marker;
476 EINA_INARRAY_FOREACH(vg_entry->vfd->anim_data->markers, marker)
477 {
478 if (!strcmp(marker->name, name))
479 {
480 if (startframe) *startframe = marker->startframe;
481 if (endframe) *endframe = marker->endframe;
482 return EINA_TRUE;
483 }
484 }
485 return EINA_FALSE;
486}
487
436Efl_VG* 488Efl_VG*
437evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry, unsigned int frame_num) 489evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry, unsigned int frame_num)
438{ 490{