summaryrefslogtreecommitdiff
path: root/src/lib/evas/vg/evas_vg_cache.c
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-07 17:37:58 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-07 18:06:38 +0900
commit072f5a2fa0ec6d714de03a983a24330bfbf856a7 (patch)
tree56d57c03852c5f1a45d97fe11048120895e10ee3 /src/lib/evas/vg/evas_vg_cache.c
parent093e32a0fb9259023cfb581ed4b5f5baf8391b72 (diff)
evas vg: code refactoring.
capsulate vector file data from efl canvas vg. hide vector file data structure, capsulate it, cut off the dependency by vector object. yet it has evas_cache_entry interface.
Diffstat (limited to 'src/lib/evas/vg/evas_vg_cache.c')
-rw-r--r--src/lib/evas/vg/evas_vg_cache.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c
index 863f6660cd..49c8fd3ee4 100644
--- a/src/lib/evas/vg/evas_vg_cache.c
+++ b/src/lib/evas/vg/evas_vg_cache.c
@@ -153,8 +153,8 @@ _evas_cache_vg_entry_free_cb(void *data)
153 free(vg_entry); 153 free(vg_entry);
154} 154}
155 155
156Eina_Bool 156static Eina_Bool
157evas_vg_save_to_file(Vg_File_Data *vfd, const char *file, const char *key, const char *flags) 157_vg_file_save(Vg_File_Data *vfd, const char *file, const char *key, const char *flags)
158{ 158{
159 Evas_Module *em; 159 Evas_Module *em;
160 Evas_Vg_Save_Func *saver; 160 Evas_Vg_Save_Func *saver;
@@ -227,7 +227,7 @@ evas_cache_vg_shutdown(void)
227} 227}
228 228
229Vg_File_Data * 229Vg_File_Data *
230evas_cache_vg_file_info(const char *file, const char *key) 230evas_cache_vg_file_open(const char *file, const char *key)
231{ 231{
232 Vg_File_Data *vfd; 232 Vg_File_Data *vfd;
233 Eina_Strbuf *hash_key; 233 Eina_Strbuf *hash_key;
@@ -300,7 +300,7 @@ _evas_cache_vg_tree_update(Vg_Cache_Entry *vg_entry)
300 return; 300 return;
301 } 301 }
302 302
303 vfd = evas_cache_vg_file_info(vg_entry->file, vg_entry->key); 303 vfd = evas_cache_vg_file_open(vg_entry->file, vg_entry->key);
304 304
305 vg_entry->root = _evas_vg_dup_vg_tree(vfd, vg_entry->w, vg_entry->h); 305 vg_entry->root = _evas_vg_dup_vg_tree(vfd, vg_entry->w, vg_entry->h);
306 eina_stringshare_del(vg_entry->file); 306 eina_stringshare_del(vg_entry->file);
@@ -363,3 +363,30 @@ evas_cache_vg_entry_del(Vg_Cache_Entry *vg_entry)
363 // FIXME implement delete logic (LRU) 363 // FIXME implement delete logic (LRU)
364} 364}
365 365
366Eina_Bool
367evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key,
368 const char *flags)
369{
370 Vg_File_Data *vfd =
371 evas_cache_vg_file_open(vg_entry->file, vg_entry->key);
372
373 if (!vfd) return EINA_FALSE;
374
375 return _vg_file_save(vfd, file, key, flags);
376}
377
378Eina_Bool
379evas_cache_vg_file_save(Efl_VG *root, int w, int h, const char *file, const char *key,
380 const char *flags)
381{
382 Vg_File_Data vfd = {};
383
384 if (!root) return EINA_FALSE;
385
386 vfd.view_box.x = w;
387 vfd.view_box.y = h;
388 vfd.root = root;
389 vfd.preserve_aspect = EINA_FALSE;
390
391 return _vg_file_save(&vfd, file, key, flags);
392}