From 2b252c45844a256777464352b63115643e5c0387 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 18 Feb 2020 09:56:15 +0900 Subject: Fix vg_cache If cached file have a vp_list it should disable file caching. --- src/lib/evas/canvas/efl_canvas_vg_object.c | 8 ++++---- src/lib/evas/canvas/evas_vg_private.h | 4 ++-- src/lib/evas/vg/evas_vg_cache.c | 21 +++++++++++---------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index cccd9e2c6b..d288dee06b 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c @@ -586,12 +586,12 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj, Eina_Position2D offset = {0, 0}; //Offset after keeping aspect ratio. void *buffer = NULL; void *key = NULL; - - evas_cache_vg_entry_value_provider_update(pd->vg_entry, efl_key_data_get(obj->object, "_vg_value_providers")); +Eina_List *vp_list = efl_key_data_get(obj->object, "_vg_value_providers"); + Eina_Bool vp_updated = evas_cache_vg_entry_value_provider_update(pd->vg_entry, vp_list); // if the size changed in between path set and the draw call; if ((vg_entry->w != w) || - (vg_entry->h != h)) + (vg_entry->h != h) || vp_updated) { Eina_Size2D size = evas_cache_vg_entry_default_size_get(pd->vg_entry); @@ -619,7 +619,7 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj, } //Size is changed, cached data is invalid. - if ((size.w != vg_entry->w) || (size.h != vg_entry->h)) + if ((size.w != vg_entry->w) || (size.h != vg_entry->h) || vp_updated) { //Not necessary, but this might be helpful for precise caching. #if 0 diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h index a6a27142ed..ca02810ffb 100644 --- a/src/lib/evas/canvas/evas_vg_private.h +++ b/src/lib/evas/canvas/evas_vg_private.h @@ -145,9 +145,9 @@ void evas_cache_vg_shutdown(void); Vg_Cache_Entry* evas_cache_vg_entry_resize(Vg_Cache_Entry *entry, int w, int h); Vg_Cache_Entry* evas_cache_vg_entry_create(Evas *evas, const Eina_File *file, const char *key, int w, int h, Eina_List *vp_list); Efl_VG* evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry, unsigned int frame_num); -void evas_cache_vg_entry_value_provider_update(Vg_Cache_Entry *vg_entry, Eina_List *vp_list); +Eina_Bool evas_cache_vg_entry_value_provider_update(Vg_Cache_Entry *vg_entry, Eina_List *vp_list); void evas_cache_vg_entry_del(Vg_Cache_Entry *vg_entry); -Vg_File_Data * evas_cache_vg_file_open(const Eina_File *file, const char *key, Evas *e); +Vg_File_Data * evas_cache_vg_file_open(const Eina_File *file, const char *key, Evas *e, Eina_List* vp_list); Eina_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); Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const Efl_File_Save_Info *info); double evas_cache_vg_anim_duration_get(const Vg_Cache_Entry *vg_entry); diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c index e9990107ee..801375f9e6 100644 --- a/src/lib/evas/vg/evas_vg_cache.c +++ b/src/lib/evas/vg/evas_vg_cache.c @@ -154,10 +154,10 @@ _evas_cache_vg_entry_free_cb(void *data) if (vg_entry->vfd->ref <= 0) { Eina_Strbuf *hash_key = eina_strbuf_new(); - eina_strbuf_append_printf(hash_key, "%s/%s/%p", + eina_strbuf_append_printf(hash_key, "%s/%s/%p/%p", eina_file_filename_get(vg_entry->file), vg_entry->key, - vg_entry->evas); + vg_entry->evas, vg_entry->vfd->vp_list); if (!eina_hash_del(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vg_entry->vfd)) ERR("Failed to delete vfd = (%p) from hash", vg_entry->vfd); eina_strbuf_free(hash_key); @@ -214,6 +214,7 @@ _root_update(Vg_Cache_Entry *vg_entry) //Shareable?? else if (vg_entry->root != vfd->root) { +printf("vg_entry->root :%p\n",vg_entry->root); if (vg_entry->root) efl_unref(vg_entry->root); vg_entry->root = efl_ref(vfd->root); } @@ -322,13 +323,13 @@ evas_cache_vg_shutdown(void) } Vg_File_Data * -evas_cache_vg_file_open(const Eina_File *file, const char *key, Evas *e) +evas_cache_vg_file_open(const Eina_File *file, const char *key, Evas *e, Eina_List* vp_list) { Vg_File_Data *vfd; Eina_Strbuf *hash_key; hash_key = eina_strbuf_new(); - eina_strbuf_append_printf(hash_key, "%s/%s/%p", eina_file_filename_get(file), key, e); + eina_strbuf_append_printf(hash_key, "%s/%s/%p/%p", eina_file_filename_get(file), key, e, vp_list); vfd = eina_hash_find(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key)); if (!vfd) { @@ -356,7 +357,6 @@ evas_cache_vg_entry_create(Evas *evas, Eina_Strbuf *hash_key; if (!vg_cache) return NULL; - //TODO: zero-sized entry is useless. how to skip it? hash_key = eina_strbuf_new(); eina_strbuf_append_printf(hash_key, "%p/%p/%s/%d/%d/%p", evas, file, key, w, h, vp_list); @@ -380,7 +380,7 @@ evas_cache_vg_entry_create(Evas *evas, } eina_strbuf_free(hash_key); vg_entry->ref++; - vg_entry->vfd = evas_cache_vg_file_open(file, key, vg_entry->evas); + vg_entry->vfd = evas_cache_vg_file_open(file, key, vg_entry->evas, vp_list); //No File?? if (!vg_entry->vfd) { @@ -504,15 +504,16 @@ evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry, unsigned int frame_num) return vg_entry->root; } -void +Eina_Bool evas_cache_vg_entry_value_provider_update(Vg_Cache_Entry *vg_entry, Eina_List *vp_list) { - if (!vg_entry) return; + if (!vg_entry) return EINA_FALSE; Vg_File_Data *vfd = vg_entry->vfd; - if (!vfd) return; + if (!vfd) return EINA_FALSE; vfd->vp_list = vp_list; + return EINA_TRUE; } void @@ -536,7 +537,7 @@ Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const Efl_File_Save_Info *info) { Vg_File_Data *vfd = - evas_cache_vg_file_open(vg_entry->file, vg_entry->key, vg_entry->evas); + evas_cache_vg_file_open(vg_entry->file, vg_entry->key, vg_entry->evas, NULL); if (!vfd) return EINA_FALSE; -- cgit v1.2.1