evas_vg_cache: Hashkey in cache uses evas

Summary:
Vg_entry is shared by different child windows.
When two or more objects load the same file
When resizing, cache_vg_entry_render can delete an active entry
while creating a new entry and deleting an existing entry.
Therefore, use cache data added evas

Test Plan:
[enable json loader]
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -203,7 +203,7 @@ option('evas-loaders-disabler',
   type : 'array',
   description : 'List of modular image/vector load  .....
   choices : ['gst', 'pdf', 'ps', 'raw', 'svg', 'rs  .....
-  value : ['webp', 'json']
+  value : ['webp']

[Test]
elementary_test -> Animation View click -> play -> Animation View click again -> ...

Reviewers: Hermet, smohanty, kimcinoo

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9740
This commit is contained in:
junsu choi 2019-09-10 20:06:18 +09:00
parent f78b4861af
commit 6d465b0b1f
3 changed files with 9 additions and 5 deletions

View File

@ -289,7 +289,8 @@ _efl_canvas_vg_object_efl_file_load(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd)
Evas_Object_Protected_Data *obj;
obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
pd->vg_entry = evas_cache_vg_entry_create(file, key,
pd->vg_entry = evas_cache_vg_entry_create(evas_object_evas_get(eo_obj),
file, key,
obj->cur->geometry.w,
obj->cur->geometry.h);
evas_object_change(eo_obj, obj);

View File

@ -18,6 +18,7 @@ typedef struct _Vg_Cache
typedef struct _Vg_Cache_Entry
{
Evas *evas;
char *hash_key;
const Eina_File *file;
Eina_Stringshare *key;
@ -124,7 +125,7 @@ struct _Efl_Canvas_Vg_Interpolation
void evas_cache_vg_init(void);
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(const Eina_File *file, const char *key, 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);
Efl_VG* evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry, unsigned int frame_num);
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);

View File

@ -365,11 +365,12 @@ evas_cache_vg_file_open(const Eina_File *file, const char *key)
Vg_Cache_Entry*
evas_cache_vg_entry_resize(Vg_Cache_Entry *vg_entry, int w, int h)
{
return evas_cache_vg_entry_create(vg_entry->file, vg_entry->key, w, h);
return evas_cache_vg_entry_create(vg_entry->evas, vg_entry->file, vg_entry->key, w, h);
}
Vg_Cache_Entry*
evas_cache_vg_entry_create(const Eina_File *file,
evas_cache_vg_entry_create(Evas *evas,
const Eina_File *file,
const char *key,
int w, int h)
{
@ -381,7 +382,7 @@ evas_cache_vg_entry_create(const Eina_File *file,
//TODO: zero-sized entry is useless. how to skip it?
hash_key = eina_strbuf_new();
eina_strbuf_append_printf(hash_key, "%p/%s/%d/%d", file, key, w, h);
eina_strbuf_append_printf(hash_key, "%p/%p/%s/%d/%d", evas, file, key, w, h);
vg_entry = eina_hash_find(vg_cache->vg_entry_hash, eina_strbuf_string_get(hash_key));
if (!vg_entry)
{
@ -396,6 +397,7 @@ evas_cache_vg_entry_create(const Eina_File *file,
vg_entry->key = eina_stringshare_add(key);
vg_entry->w = w;
vg_entry->h = h;
vg_entry->evas = evas;
vg_entry->hash_key = eina_strbuf_string_steal(hash_key);
eina_hash_direct_add(vg_cache->vg_entry_hash, vg_entry->hash_key, vg_entry);
}