summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_model_load.c
diff options
context:
space:
mode:
authorBogdan Devichev <b.devichev@samsung.com>2014-12-12 17:23:49 +0200
committerCedric BAIL <cedric@osg.samsung.com>2014-12-23 21:20:21 +0100
commitdd605257984478674d2a5d4946a870f167e2bf69 (patch)
treeaf549bbd69a00d81f8d6bd9a05dc979431858cf9 /src/lib/evas/common/evas_model_load.c
parent243df1aaba09a05ef65b8666d0a54c6b8f1cd6a2 (diff)
evas: a _mmap version of the file_set is added.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_model_load.c60
1 files changed, 44 insertions, 16 deletions
diff --git a/src/lib/evas/common/evas_model_load.c b/src/lib/evas/common/evas_model_load.c
index 0598d31e21..e00290e315 100644
--- a/src/lib/evas/common/evas_model_load.c
+++ b/src/lib/evas/common/evas_model_load.c
@@ -8,11 +8,35 @@
8#include "evas_private.h" 8#include "evas_private.h"
9 9
10void 10void
11evas_common_load_model_to_file(Evas_3D_Mesh *model, const char *file) 11_evas_common_load_model(Evas_3D_Mesh *model,
12 Eina_File *file,
13 const char *file_path)
12{ 14{
13 char *p; 15 char *p;
14 char *loader_type = NULL; 16 char *loader_type = NULL;
15 17
18 p = strrchr(file_path, '.');
19 if (p)
20 {
21 p++;
22#define CHECK_EXTENTION_BY_FILE_NAME(extention) \
23 if (!strcasecmp(p, #extention)) \
24 { \
25 evas_model_load_file_##extention(model, file); \
26 loader_type = #extention; \
27 }
28 CHECK_EXTENTION_BY_FILE_NAME(eet)
29 CHECK_EXTENTION_BY_FILE_NAME(md2)
30 CHECK_EXTENTION_BY_FILE_NAME(obj)
31 CHECK_EXTENTION_BY_FILE_NAME(ply)
32#undef CHECK_EXTENTION_BY_FILE_NAME
33 }
34 if (!loader_type) ERR("Invalid mesh file type.");
35}
36
37void
38evas_common_load_model_from_file(Evas_3D_Mesh *model, const char *file)
39{
16 Eina_File *tmp_file = eina_file_open(file, 0); 40 Eina_File *tmp_file = eina_file_open(file, 0);
17 Eina_File *e_file = eina_file_dup(tmp_file); 41 Eina_File *e_file = eina_file_dup(tmp_file);
18 42
@@ -29,23 +53,27 @@ evas_common_load_model_to_file(Evas_3D_Mesh *model, const char *file)
29 53
30 eina_file_close(tmp_file); 54 eina_file_close(tmp_file);
31 55
32 p = strrchr(file, '.'); 56 _evas_common_load_model(model, e_file, file);
33 if (p) 57
58 eina_file_close(e_file);
59 e_file = NULL;
60}
61
62void
63evas_common_load_model_from_eina_file(Evas_3D_Mesh *model, Eina_File *file)
64{
65 Eina_File *e_file = eina_file_dup(file);
66
67 if (e_file == NULL)
34 { 68 {
35 p++; 69 ERR("Failed to open file %s\n", file);
36#define CHECK_EXTENTION_BY_FILE_NAME(extention) \ 70 eina_file_close(e_file);
37 if (!strcasecmp(p, #extention)) \ 71 e_file = NULL;
38 { \ 72 ERR("Failed to initialize loader.");
39 evas_model_load_file_##extention(model, e_file); \ 73 return;
40 loader_type = #extention; \
41 }
42 CHECK_EXTENTION_BY_FILE_NAME(eet)
43 CHECK_EXTENTION_BY_FILE_NAME(md2)
44 CHECK_EXTENTION_BY_FILE_NAME(obj)
45 CHECK_EXTENTION_BY_FILE_NAME(ply)
46#undef CHECK_EXTENTION_BY_FILE_NAME
47 } 74 }
48 if (!loader_type) ERR("Invalid mesh file type."); 75
76 _evas_common_load_model(model, e_file, eina_file_filename_get(e_file));
49 77
50 eina_file_close(e_file); 78 eina_file_close(e_file);
51 e_file = NULL; 79 e_file = NULL;