summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-07 18:42:45 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-07 19:08:34 +0900
commit950059ce9a85b070a094d7e17ad43c27dd52065e (patch)
treefd57d967712b92b83fb2ded223a0677c44532459 /src
parent072f5a2fa0ec6d714de03a983a24330bfbf856a7 (diff)
evas vg: revise basic vg cache logic.
There was a big trouble that vg cache didn't free cached data properly. Plus, there was a unnecessary copy of vg tree data. This revised version is a improvement of our evas vg cache in stable and optmization.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c92
-rw-r--r--src/lib/evas/canvas/evas_vg_private.h9
-rw-r--r--src/lib/evas/include/evas_private.h3
-rw-r--r--src/lib/evas/vg/evas_vg_cache.c195
-rw-r--r--src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c17
-rw-r--r--src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c16
-rw-r--r--src/static_libs/vg_common/vg_common.c1
7 files changed, 210 insertions, 123 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c
index 57b9a1bbd6..a227c6bd9f 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -113,27 +113,27 @@ _evas_vg_resize(void *data, const Efl_Event *ev)
113 _update_vgtree_viewport(ev->object, pd); 113 _update_vgtree_viewport(ev->object, pd);
114} 114}
115 115
116/* the actual api call to add a vector graphic object */
117EAPI Evas_Object *
118evas_object_vg_add(Evas *e)
119{
120 e = evas_find(e);
121 EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
122 // TODO: Ask backend to return the main Ector_Surface
123 return efl_add(MY_CLASS, e, efl_canvas_object_legacy_ctor(efl_added));
124}
125
126EOLIAN static Efl_VG * 116EOLIAN static Efl_VG *
127_efl_canvas_vg_object_root_node_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Object_Data *pd) 117_efl_canvas_vg_object_root_node_get(const Eo *obj, Efl_Canvas_Vg_Object_Data *pd)
128{ 118{
129 Efl_VG *root = NULL; 119 Efl_VG *root = NULL;
130 120
131 if (pd->vg_entry) 121 if (pd->vg_entry)
132 root = evas_cache_vg_tree_get(pd->vg_entry); 122 {
133 else if (pd->user_entry) 123 Evas_Coord w, h;
134 root = pd->user_entry->root; 124 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
135 else 125
136 root = pd->root; 126 //Update vg data with current size.
127 if ((pd->vg_entry->w != w) || (pd->vg_entry->h != h))
128 {
129 Vg_Cache_Entry *vg_entry = evas_cache_vg_entry_resize(pd->vg_entry, w, h);
130 evas_cache_vg_entry_del(pd->vg_entry);
131 pd->vg_entry = vg_entry;
132 }
133 root = evas_cache_vg_tree_get(pd->vg_entry);
134 }
135 else if (pd->user_entry) root = pd->user_entry->root;
136 else root = pd->root;
137 137
138 return root; 138 return root;
139} 139}
@@ -256,7 +256,7 @@ _efl_canvas_vg_object_viewbox_align_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vg
256} 256}
257 257
258EOLIAN static Eina_Bool 258EOLIAN static Eina_Bool
259_efl_canvas_vg_object_efl_file_file_set(Eo *obj, Efl_Canvas_Vg_Object_Data *pd, const char *file, const char *key) 259_efl_canvas_vg_object_efl_file_file_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, const char *file, const char *key)
260{ 260{
261 Vg_Cache_Entry *old_entry; 261 Vg_Cache_Entry *old_entry;
262 int w, h; 262 int w, h;
@@ -264,10 +264,18 @@ _efl_canvas_vg_object_efl_file_file_set(Eo *obj, Efl_Canvas_Vg_Object_Data *pd,
264 if (!file) return EINA_FALSE; 264 if (!file) return EINA_FALSE;
265 265
266 old_entry = pd->vg_entry; 266 old_entry = pd->vg_entry;
267 evas_object_geometry_get(obj, NULL, NULL, &w, &h); 267
268 pd->vg_entry = evas_cache_vg_entry_find(file, key, w, h); 268 Evas_Object_Protected_Data *obj;
269 if (pd->vg_entry != old_entry) 269 obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
270 evas_object_change(obj, efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS)); 270
271 if (file)
272 pd->vg_entry = evas_cache_vg_entry_create(file, key,
273 obj->cur->geometry.w,
274 obj->cur->geometry.h);
275 else
276 pd->vg_entry = NULL;
277
278 evas_object_change(eo_obj, obj);
271 evas_cache_vg_entry_del(old_entry); 279 evas_cache_vg_entry_del(old_entry);
272 280
273 return EINA_TRUE; 281 return EINA_TRUE;
@@ -321,6 +329,7 @@ _efl_canvas_vg_object_efl_object_destructor(Eo *eo_obj, Efl_Canvas_Vg_Object_Dat
321 329
322 if (pd->user_entry) free(pd->user_entry); 330 if (pd->user_entry) free(pd->user_entry);
323 pd->user_entry = NULL; 331 pd->user_entry = NULL;
332 evas_cache_vg_entry_del(pd->vg_entry);
324 333
325 efl_destructor(efl_super(eo_obj, MY_CLASS)); 334 efl_destructor(efl_super(eo_obj, MY_CLASS));
326} 335}
@@ -472,16 +481,15 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj,
472 int x, int y, int w, int h, Eina_Bool do_async) 481 int x, int y, int w, int h, Eina_Bool do_async)
473{ 482{
474 Vg_Cache_Entry *vg_entry = pd->vg_entry; 483 Vg_Cache_Entry *vg_entry = pd->vg_entry;
475 Efl_VG *root, *dupe_root; 484 Efl_VG *root;
476 485
477 // if the size changed in between path set and the draw call; 486 // if the size changed in between path set and the draw call;
478 487
479 if ((vg_entry->w != w) || 488 if ((vg_entry->w != w) ||
480 (vg_entry->h != h)) 489 (vg_entry->h != h))
481 { 490 {
482 evas_cache_vg_entry_del(vg_entry); 491 vg_entry = evas_cache_vg_entry_resize(vg_entry, w, h);
483 vg_entry = evas_cache_vg_entry_find(vg_entry->file, vg_entry->key, 492 evas_cache_vg_entry_del(pd->vg_entry);
484 w, h);
485 pd->vg_entry = vg_entry; 493 pd->vg_entry = vg_entry;
486 } 494 }
487 root = evas_cache_vg_tree_get(vg_entry); 495 root = evas_cache_vg_tree_get(vg_entry);
@@ -490,18 +498,8 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj,
490 void *buffer = ENFN->ector_surface_cache_get(engine, root); 498 void *buffer = ENFN->ector_surface_cache_get(engine, root);
491 499
492 if (!buffer) 500 if (!buffer)
493 { 501 buffer = _render_to_buffer(obj, pd, engine, surface, root, w, h, root, NULL,
494 dupe_root = efl_duplicate(root); 502 do_async);
495 // render to the buffer
496 buffer = _render_to_buffer(obj, pd,
497 engine, surface,
498 dupe_root,
499 w, h,
500 root,
501 buffer,
502 do_async);
503 efl_unref(dupe_root);
504 }
505 else 503 else
506 //cache reference was increased when we get the cache. 504 //cache reference was increased when we get the cache.
507 ENFN->ector_surface_cache_drop(engine, root); 505 ENFN->ector_surface_cache_drop(engine, root);
@@ -525,13 +523,14 @@ _user_vg_entry_render(Evas_Object_Protected_Data *obj,
525 if ((user_entry->w != w ) || 523 if ((user_entry->w != w ) ||
526 (user_entry->h != h)) 524 (user_entry->h != h))
527 { 525 {
528 ENFN->ector_surface_cache_drop(engine, user_entry); 526 ENFN->ector_surface_cache_drop(engine, user_entry->root);
529 user_entry->w = w; 527 user_entry->w = w;
530 user_entry->h = h; 528 user_entry->h = h;
531 pd->user_entry = user_entry;
532 } 529 }
530
533 //if the buffer is not created yet 531 //if the buffer is not created yet
534 void *buffer = ENFN->ector_surface_cache_get(engine, user_entry); 532 void *buffer = ENFN->ector_surface_cache_get(engine, user_entry->root);
533
535 if (!buffer) 534 if (!buffer)
536 { 535 {
537 // render to the buffer 536 // render to the buffer
@@ -554,7 +553,8 @@ _user_vg_entry_render(Evas_Object_Protected_Data *obj,
554 user_entry, 553 user_entry,
555 buffer, 554 buffer,
556 do_async); 555 do_async);
557 ENFN->ector_surface_cache_drop(engine, user_entry); 556 //cache reference was increased when we get the cache.
557 ENFN->ector_surface_cache_drop(engine, user_entry->root);
558 } 558 }
559 559
560 _render_buffer_to_screen(obj, 560 _render_buffer_to_screen(obj,
@@ -751,4 +751,14 @@ _efl_canvas_vg_object_was_opaque(Evas_Object *eo_obj EINA_UNUSED,
751 return 0; 751 return 0;
752} 752}
753 753
754/* the actual api call to add a vector graphic object */
755EAPI Evas_Object *
756evas_object_vg_add(Evas *e)
757{
758 e = evas_find(e);
759 EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
760 // TODO: Ask backend to return the main Ector_Surface
761 return efl_add(MY_CLASS, e, efl_canvas_object_legacy_ctor(efl_added));
762}
763
754#include "efl_canvas_vg_object.eo.c" 764#include "efl_canvas_vg_object.eo.c"
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h
index 5852b1b9b1..a4d11d06cb 100644
--- a/src/lib/evas/canvas/evas_vg_private.h
+++ b/src/lib/evas/canvas/evas_vg_private.h
@@ -25,6 +25,8 @@ typedef struct _Vg_Cache_Entry
25 int h; 25 int h;
26 Efl_VG *root; 26 Efl_VG *root;
27 int ref; 27 int ref;
28 Vg_File_Data *vfd;
29
28} Vg_Cache_Entry; 30} Vg_Cache_Entry;
29 31
30// holds the vg tree info set by the user 32// holds the vg tree info set by the user
@@ -100,9 +102,10 @@ struct _Efl_Canvas_Vg_Interpolation
100 102
101void evas_cache_vg_init(void); 103void evas_cache_vg_init(void);
102void evas_cache_vg_shutdown(void); 104void evas_cache_vg_shutdown(void);
103Vg_Cache_Entry* evas_cache_vg_entry_find(const char *file, const char *key, int w, int h); 105Vg_Cache_Entry* evas_cache_vg_entry_resize(Vg_Cache_Entry *entry, int w, int h);
104Efl_VG* evas_cache_vg_tree_get(Vg_Cache_Entry *svg_entry); 106Vg_Cache_Entry* evas_cache_vg_entry_create(const char *file, const char *key, int w, int h);
105void evas_cache_vg_entry_del(Vg_Cache_Entry *svg_entry); 107Efl_VG* evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry);
108void evas_cache_vg_entry_del(Vg_Cache_Entry *vg_entry);
106Vg_File_Data * evas_cache_vg_file_open(const char *file, const char *key); 109Vg_File_Data * evas_cache_vg_file_open(const char *file, const char *key);
107Eina_Bool evas_cache_vg_file_save(Efl_VG *root, int w, int h, const char *file, const char *key, const char *flags); 110Eina_Bool evas_cache_vg_file_save(Efl_VG *root, int w, int h, const char *file, const char *key, const char *flags);
108Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const char *flags); 111Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const char *flags);
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 75761f06d9..34dffee36b 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1508,6 +1508,9 @@ struct _Vg_File_Data
1508 Efl_VG *root; 1508 Efl_VG *root;
1509 Evas_Vg_Load_Func *loader; 1509 Evas_Vg_Load_Func *loader;
1510 Eina_Rectangle view_box; 1510 Eina_Rectangle view_box;
1511 int ref;
1512
1513 Eina_Bool static_viewbox: 1;
1511 Eina_Bool preserve_aspect : 1; //Used in SVG 1514 Eina_Bool preserve_aspect : 1; //Used in SVG
1512}; 1515};
1513 1516
diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c
index 49c8fd3ee4..ec5fc6b0be 100644
--- a/src/lib/evas/vg/evas_vg_cache.c
+++ b/src/lib/evas/vg/evas_vg_cache.c
@@ -69,7 +69,7 @@ _find_loader_module(const char *file)
69 return em; 69 return em;
70} 70}
71 71
72Vg_File_Data * 72static Vg_File_Data *
73_vg_load_from_file(const char *file, const char *key) 73_vg_load_from_file(const char *file, const char *key)
74{ 74{
75 Evas_Module *em; 75 Evas_Module *em;
@@ -136,9 +136,8 @@ _find_saver_module(const char *file)
136static void 136static void
137_evas_cache_vg_data_free_cb(void *data) 137_evas_cache_vg_data_free_cb(void *data)
138{ 138{
139 Vg_File_Data *val = data; 139 Vg_File_Data *vfd = data;
140 efl_unref(val->root); 140 vfd->loader->file_close(vfd);
141 free(val);
142} 141}
143 142
144static void 143static void
@@ -146,7 +145,21 @@ _evas_cache_vg_entry_free_cb(void *data)
146{ 145{
147 Vg_Cache_Entry *vg_entry = data; 146 Vg_Cache_Entry *vg_entry = data;
148 147
149 eina_stringshare_del(vg_entry->file); 148 if (vg_entry->vfd)
149 {
150 vg_entry->vfd->ref--;
151 if (vg_entry->vfd->ref <= 0)
152 {
153 Eina_Strbuf *hash_key = eina_strbuf_new();
154 eina_strbuf_append_printf(hash_key, "%s/%s",
155 vg_entry->file,
156 vg_entry->key);
157 if (!eina_hash_del(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vg_entry->vfd))
158 ERR("Failed to delete vfd = (%p) from hash", vg_entry->vfd);
159 eina_strbuf_free(hash_key);
160 }
161 }
162
150 eina_stringshare_del(vg_entry->key); 163 eina_stringshare_del(vg_entry->key);
151 free(vg_entry->hash_key); 164 free(vg_entry->hash_key);
152 efl_unref(vg_entry->root); 165 efl_unref(vg_entry->root);
@@ -194,6 +207,65 @@ _vg_file_save(Vg_File_Data *vfd, const char *file, const char *key, const char *
194 return EINA_TRUE; 207 return EINA_TRUE;
195} 208}
196 209
210static Efl_VG*
211_cached_root_get(Vg_Cache_Entry *vg_entry)
212{
213 return vg_entry->root;
214}
215
216static void
217_caching_root_update(Vg_Cache_Entry *vg_entry)
218{
219 Vg_File_Data *vfd = vg_entry->vfd;
220
221 /* Optimization: static viewbox may have same root data regardless of size.
222 So we can't use the root data directly, but copy it for each vg_entries.
223 In the meantime, non-static viewbox root data may have difference instance for each
224 size. So it's affordable to share the root data for each vg_entries. */
225 if (vfd->static_viewbox)
226 {
227 /* TODO: Yet trivial but still we may have a better solution to
228 avoid this unnecessary copy. If the ector surface key is not
229 to this root pointer. */
230 vg_entry->root = efl_duplicate(vfd->root);
231 }
232 else if (vg_entry->root != vfd->root)
233 {
234 if (vg_entry->root) efl_unref(vg_entry->root);
235 vg_entry->root = efl_ref(vfd->root);
236 }
237}
238
239static void
240_local_transform(Efl_VG *root, double w, double h, Vg_File_Data *vfd)
241{
242 double sx = 0, sy= 0, scale;
243 Eina_Matrix3 m;
244
245 if (!vfd->static_viewbox) return;
246 if (vfd->view_box.w == w && vfd->view_box.h == h) return;
247
248 sx = w / vfd->view_box.w;
249 sy = h / vfd->view_box.h;
250
251 scale = sx < sy ? sx : sy;
252 eina_matrix3_identity(&m);
253
254 // align hcenter and vcenter
255 if (vfd->preserve_aspect)
256 {
257 eina_matrix3_translate(&m, (w - vfd->view_box.w * scale)/2.0, (h - vfd->view_box.h * scale)/2.0);
258 eina_matrix3_scale(&m, scale, scale);
259 eina_matrix3_translate(&m, -vfd->view_box.x, -vfd->view_box.y);
260 }
261 else
262 {
263 eina_matrix3_scale(&m, sx, sy);
264 eina_matrix3_translate(&m, -vfd->view_box.x, -vfd->view_box.y);
265 }
266 efl_canvas_vg_node_transformation_set(root, &m);
267}
268
197void 269void
198evas_cache_vg_init(void) 270evas_cache_vg_init(void)
199{ 271{
@@ -245,82 +317,26 @@ evas_cache_vg_file_open(const char *file, const char *key)
245 return vfd; 317 return vfd;
246} 318}
247 319
248static void 320Vg_Cache_Entry*
249_local_transformation(Efl_VG *root, double w, double h, Vg_File_Data *vfd) 321evas_cache_vg_entry_resize(Vg_Cache_Entry *vg_entry, int w, int h)
250{
251 double sx = 0, sy= 0, scale;
252 Eina_Matrix3 m;
253
254 if (vfd->view_box.w)
255 sx = w/vfd->view_box.w;
256 if (vfd->view_box.h)
257 sy = h/vfd->view_box.h;
258
259 scale = sx < sy ? sx: sy;
260 eina_matrix3_identity(&m);
261
262 // allign hcenter and vcenter
263 if (vfd->preserve_aspect)
264 {
265 eina_matrix3_translate(&m, (w - vfd->view_box.w * scale)/2.0, (h - vfd->view_box.h * scale)/2.0);
266 eina_matrix3_scale(&m, scale, scale);
267 eina_matrix3_translate(&m, -vfd->view_box.x, -vfd->view_box.y);
268 }
269 else
270 {
271 eina_matrix3_scale(&m, sx, sy);
272 eina_matrix3_translate(&m, -vfd->view_box.x, -vfd->view_box.y);
273 }
274 efl_canvas_vg_node_transformation_set(root, &m);
275}
276
277static Efl_VG *
278_evas_vg_dup_vg_tree(Vg_File_Data *vfd, double w, double h)
279{
280 Efl_VG *root;
281
282 if (!vfd) return NULL;
283 if (w < 1 || h < 1) return NULL;
284
285 root = efl_duplicate(vfd->root);
286 _local_transformation(root, w, h, vfd);
287
288 return root;
289}
290
291static void
292_evas_cache_vg_tree_update(Vg_Cache_Entry *vg_entry)
293{ 322{
294 Vg_File_Data *vfd = NULL; 323 return evas_cache_vg_entry_create(vg_entry->file, vg_entry->key, w, h);
295 if(!vg_entry) return;
296
297 if (!vg_entry->file)
298 {
299 vg_entry->root = NULL;
300 return;
301 }
302
303 vfd = evas_cache_vg_file_open(vg_entry->file, vg_entry->key);
304
305 vg_entry->root = _evas_vg_dup_vg_tree(vfd, vg_entry->w, vg_entry->h);
306 eina_stringshare_del(vg_entry->file);
307 eina_stringshare_del(vg_entry->key);
308 vg_entry->file = NULL;
309 vg_entry->key = NULL;
310} 324}
311 325
312Vg_Cache_Entry* 326Vg_Cache_Entry*
313evas_cache_vg_entry_find(const char *file, const char *key, 327evas_cache_vg_entry_create(const char *file,
314 int w, int h) 328 const char *key,
329 int w, int h)
315{ 330{
316 Vg_Cache_Entry* vg_entry; 331 Vg_Cache_Entry* vg_entry;
317 Eina_Strbuf *hash_key; 332 Eina_Strbuf *hash_key;
318 333
319 if (!vg_cache) return NULL; 334 if (!vg_cache) return NULL;
320 335
336 //TODO: zero-sized entry is useless. how to skip it?
337
321 hash_key = eina_strbuf_new(); 338 hash_key = eina_strbuf_new();
322 eina_strbuf_append_printf(hash_key, "%s/%s/%d/%d", 339 eina_strbuf_append_printf(hash_key, "%s/%s/%d/%d", file, key, w, h);
323 file, key, w, h);
324 vg_entry = eina_hash_find(vg_cache->vg_entry_hash, eina_strbuf_string_get(hash_key)); 340 vg_entry = eina_hash_find(vg_cache->vg_entry_hash, eina_strbuf_string_get(hash_key));
325 if (!vg_entry) 341 if (!vg_entry)
326 { 342 {
@@ -340,16 +356,42 @@ evas_cache_vg_entry_find(const char *file, const char *key,
340 } 356 }
341 eina_strbuf_free(hash_key); 357 eina_strbuf_free(hash_key);
342 vg_entry->ref++; 358 vg_entry->ref++;
359
360 vg_entry->vfd = evas_cache_vg_file_open(file, key);
361 //No File??
362 if (!vg_entry->vfd)
363 {
364 evas_cache_vg_entry_del(vg_entry);
365 return NULL;
366 }
367 vg_entry->vfd->ref++;
368
343 return vg_entry; 369 return vg_entry;
344} 370}
345 371
346Efl_VG* 372Efl_VG*
347evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry) 373evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry)
348{ 374{
349 if (vg_entry->root) return vg_entry->root; 375 if (!vg_entry) return NULL;
376 if ((vg_entry->w < 1) || (vg_entry->h < 1)) return NULL;
377
378 Vg_File_Data *vfd = vg_entry->vfd;
379 if (!vfd) return NULL;
350 380
351 if (vg_entry->file) 381 Efl_VG *root = _cached_root_get(vg_entry);
352 _evas_cache_vg_tree_update(vg_entry); 382 if (root) return root;
383
384 if (!vfd->static_viewbox)
385 {
386 vfd->view_box.w = vg_entry->w;
387 vfd->view_box.h = vg_entry->h;
388 }
389
390 if (!vfd->loader->file_data(vfd)) return NULL;
391
392 _caching_root_update(vg_entry);
393
394 _local_transform(vg_entry->root, vg_entry->w, vg_entry->h, vfd);
353 395
354 return vg_entry->root; 396 return vg_entry->root;
355} 397}
@@ -357,10 +399,11 @@ evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry)
357void 399void
358evas_cache_vg_entry_del(Vg_Cache_Entry *vg_entry) 400evas_cache_vg_entry_del(Vg_Cache_Entry *vg_entry)
359{ 401{
360 if (!vg_entry) return; 402 if (!vg_cache || !vg_entry) return;
361
362 vg_entry->ref--; 403 vg_entry->ref--;
363 // FIXME implement delete logic (LRU) 404 if (vg_entry->ref > 0) return;
405 if (!eina_hash_del(vg_cache->vg_entry_hash, vg_entry->hash_key, vg_entry))
406 ERR("Failed to delete vg_entry = (%p) from hash", vg_entry);
364} 407}
365 408
366Eina_Bool 409Eina_Bool
diff --git a/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c b/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c
index 2a8356b007..746f2253b9 100644
--- a/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c
+++ b/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c
@@ -38,13 +38,26 @@ evas_vg_load_file_open_eet(const char *file, const char *key, int *error EINA_UN
38 { 38 {
39 *error = EVAS_LOAD_ERROR_NONE; 39 *error = EVAS_LOAD_ERROR_NONE;
40 } 40 }
41
42 return vg_common_create_vg_node(node); 41 return vg_common_create_vg_node(node);
43} 42}
44 43
44static Eina_Bool
45evas_vg_load_file_close_eet(Vg_File_Data *vfd EINA_UNUSED)
46{
47 return EINA_TRUE;
48}
49
50static Eina_Bool
51evas_vg_load_file_data_eet(Vg_File_Data *vfd EINA_UNUSED)
52{
53 return EINA_TRUE;
54}
55
45static Evas_Vg_Load_Func evas_vg_load_eet_func = 56static Evas_Vg_Load_Func evas_vg_load_eet_func =
46{ 57{
47 evas_vg_load_file_open_eet 58 evas_vg_load_file_open_eet,
59 evas_vg_load_file_close_eet,
60 evas_vg_load_file_data_eet
48}; 61};
49 62
50static int 63static int
diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
index 67a5fc63d0..340758afd3 100644
--- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
+++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
@@ -2325,6 +2325,18 @@ _update_gradient(Svg_Node *node, Eina_List *grad_list)
2325 } 2325 }
2326 } 2326 }
2327} 2327}
2328static Eina_Bool
2329evas_vg_load_file_data_svg(Vg_File_Data *vfd EINA_UNUSED)
2330{
2331 return EINA_TRUE;
2332}
2333
2334static Eina_Bool
2335evas_vg_load_file_close_svg(Vg_File_Data *vfd)
2336{
2337 if (vfd->root) efl_unref(vfd->root);
2338 return EINA_TRUE;
2339}
2328 2340
2329static Vg_File_Data* 2341static Vg_File_Data*
2330evas_vg_load_file_open_svg(const char *file, const char *key EINA_UNUSED, int *error EINA_UNUSED) 2342evas_vg_load_file_open_svg(const char *file, const char *key EINA_UNUSED, int *error EINA_UNUSED)
@@ -2377,7 +2389,9 @@ evas_vg_load_file_open_svg(const char *file, const char *key EINA_UNUSED, int *e
2377 2389
2378static Evas_Vg_Load_Func evas_vg_load_svg_func = 2390static Evas_Vg_Load_Func evas_vg_load_svg_func =
2379{ 2391{
2380 evas_vg_load_file_open_svg 2392 evas_vg_load_file_open_svg,
2393 evas_vg_load_file_close_svg,
2394 evas_vg_load_file_data_svg,
2381}; 2395};
2382 2396
2383static int 2397static int
diff --git a/src/static_libs/vg_common/vg_common.c b/src/static_libs/vg_common/vg_common.c
index 1593a089ed..1eb5b5831f 100644
--- a/src/static_libs/vg_common/vg_common.c
+++ b/src/static_libs/vg_common/vg_common.c
@@ -832,6 +832,7 @@ vg_common_create_vg_node(Svg_Node *node)
832 vg_data->view_box.w = node->node.doc.vw; 832 vg_data->view_box.w = node->node.doc.vw;
833 vg_data->view_box.h = node->node.doc.vh; 833 vg_data->view_box.h = node->node.doc.vh;
834 vg_data->preserve_aspect = node->node.doc.preserve_aspect; 834 vg_data->preserve_aspect = node->node.doc.preserve_aspect;
835 vg_data->static_viewbox = EINA_TRUE;
835 vg_data->root = vg_common_create_vg_node_helper(node, NULL, vg_data); 836 vg_data->root = vg_common_create_vg_node_helper(node, NULL, vg_data);
836 837
837 return vg_data; 838 return vg_data;