vector json: use lottie apis case by case.
authorHermet Park <hermetpark@gmail.com>
Tue, 15 Oct 2019 06:03:47 +0000 (15:03 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 11 Nov 2019 02:18:25 +0000 (11:18 +0900)
We can request loading from data only in case of actual memory map.
The lottie-player would take care of the parsing on utf8/16/32 formats
more precisely so that we don't need to take care of this converting
from the memory.

src/modules/evas/vg_loaders/json/evas_vg_load_json.c

index 11897bb..fbcfa9c 100644 (file)
@@ -43,11 +43,17 @@ evas_vg_load_file_open_json(Eina_File *file,
 
    Lottie_Animation *lot_anim = NULL;
 
-   const char *data = (const char*) eina_file_map_all(file, EINA_FILE_SEQUENTIAL);
-   if (!data) goto err;
-   //@TODO pass corrct external_resource path.
-   lot_anim = lottie_animation_from_data(data, key ? key:eina_file_filename_get(file), " ");
-   eina_file_map_free(file, (void *) data);
+   //Edje may use virtual memory.
+   if (eina_file_virtual(file))
+     {
+        const char *data = (const char*) eina_file_map_all(file, EINA_FILE_SEQUENTIAL);
+        if (!data) goto err;
+        //@TODO pass corrct external_resource path.
+        lot_anim = lottie_animation_from_data(data, key ? key:eina_file_filename_get(file), " ");
+        eina_file_map_free(file, (void *) data);
+     }
+   else
+     lot_anim = lottie_animation_from_file(eina_file_filename_get(file));
 
    if (!lot_anim)
      {