summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--configure.ac4
-rw-r--r--m4/evas_check_loader.m416
-rw-r--r--src/Makefile_Evas.am27
-rw-r--r--src/lib/evas/file/evas_module.c4
-rw-r--r--src/modules/evas/loaders/dds/evas_image_load_dds.c153
5 files changed, 204 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 2a798ef441..9ca05dc6b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1553,6 +1553,7 @@ ARG_ENABLE_EVAS_IMAGE_LOADER(WBMP, static)
1553ARG_ENABLE_EVAS_IMAGE_LOADER(WEBP, no) 1553ARG_ENABLE_EVAS_IMAGE_LOADER(WEBP, no)
1554ARG_ENABLE_EVAS_IMAGE_LOADER(XPM, static) 1554ARG_ENABLE_EVAS_IMAGE_LOADER(XPM, static)
1555ARG_ENABLE_EVAS_IMAGE_LOADER(TGV, static) 1555ARG_ENABLE_EVAS_IMAGE_LOADER(TGV, static)
1556ARG_ENABLE_EVAS_IMAGE_LOADER(DDS, static)
1556 1557
1557### Default values 1558### Default values
1558 1559
@@ -1843,6 +1844,7 @@ EVAS_CHECK_IMAGE_LOADER([WBMP], [${want_evas_image_loader_wbmp}])
1843EVAS_CHECK_IMAGE_LOADER([WEBP], [${want_evas_image_loader_webp}]) 1844EVAS_CHECK_IMAGE_LOADER([WEBP], [${want_evas_image_loader_webp}])
1844EVAS_CHECK_IMAGE_LOADER([XPM], [${want_evas_image_loader_xpm}]) 1845EVAS_CHECK_IMAGE_LOADER([XPM], [${want_evas_image_loader_xpm}])
1845EVAS_CHECK_IMAGE_LOADER([TGV], [${want_evas_image_loader_tgv}]) 1846EVAS_CHECK_IMAGE_LOADER([TGV], [${want_evas_image_loader_tgv}])
1847EVAS_CHECK_IMAGE_LOADER([DDS], [${want_evas_image_loader_tgv}])
1846 1848
1847EFL_EVAL_PKGS([EVAS]) 1849EFL_EVAL_PKGS([EVAS])
1848 1850
@@ -2050,6 +2052,8 @@ if test "x${build_gui}" = "xno"; then
2050 AM_CONDITIONAL([EVAS_STATIC_BUILD_XPM], [false]) 2052 AM_CONDITIONAL([EVAS_STATIC_BUILD_XPM], [false])
2051 AM_CONDITIONAL([BUILD_LOADER_TGV], [false]) 2053 AM_CONDITIONAL([BUILD_LOADER_TGV], [false])
2052 AM_CONDITIONAL([EVAS_STATIC_BUILD_TGV], [false]) 2054 AM_CONDITIONAL([EVAS_STATIC_BUILD_TGV], [false])
2055 AM_CONDITIONAL([BUILD_LOADER_DDS], [false])
2056 AM_CONDITIONAL([EVAS_STATIC_BUILD_DDS], [false])
2053 AM_CONDITIONAL([EVAS_CSERVE2], [false]) 2057 AM_CONDITIONAL([EVAS_CSERVE2], [false])
2054fi 2058fi
2055 2059
diff --git a/m4/evas_check_loader.m4 b/m4/evas_check_loader.m4
index 07d9cdd87e..c7ab0dcdeb 100644
--- a/m4/evas_check_loader.m4
+++ b/m4/evas_check_loader.m4
@@ -42,6 +42,22 @@ AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4])
42 42
43]) 43])
44 44
45dnl use: EVAS_CHECK_LOADER_DEP_DDS(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
46
47AC_DEFUN([EVAS_CHECK_LOADER_DEP_DDS],
48[
49
50have_dep="yes"
51evas_image_loader_[]$1[]_cflags=""
52evas_image_loader_[]$1[]_libs=""
53
54AC_SUBST([evas_image_loader_$1_cflags])
55AC_SUBST([evas_image_loader_$1_libs])
56
57AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4])
58
59])
60
45dnl use: EVAS_CHECK_LOADER_DEP_EET(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 61dnl use: EVAS_CHECK_LOADER_DEP_EET(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
46 62
47AC_DEFUN([EVAS_CHECK_LOADER_DEP_EET], 63AC_DEFUN([EVAS_CHECK_LOADER_DEP_EET],
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 764cfca5ad..bc1a65f679 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -1372,6 +1372,33 @@ modules_evas_loaders_bmp_module_la_LIBTOOLFLAGS = --tag=disable-static
1372endif 1372endif
1373endif 1373endif
1374 1374
1375if BUILD_LOADER_DDS
1376if EVAS_STATIC_BUILD_DDS
1377lib_evas_libevas_la_SOURCES += modules/evas/loaders/dds/evas_image_load_dds.c
1378lib_evas_libevas_la_CPPFLAGS += @evas_image_loader_dds_cflags@
1379lib_evas_libevas_la_LIBADD += @evas_image_loader_dds_libs@
1380if EVAS_CSERVE2
1381bin_evas_evas_cserve2_slave_SOURCES += modules/evas/loaders/dds/evas_image_load_dds.c
1382bin_evas_evas_cserve2_slave_CPPFLAGS += @evas_image_loader_dds_cflags@
1383bin_evas_evas_cserve2_slave_LDADD += @evas_image_loader_dds_libs@
1384endif
1385else
1386loaderddspkgdir = $(libdir)/evas/modules/loaders/dds/$(MODULE_ARCH)
1387loaderddspkg_LTLIBRARIES = modules/evas/loaders/dds/module.la
1388modules_evas_loaders_dds_module_la_SOURCES = modules/evas/loaders/dds/evas_image_load_dds.c
1389modules_evas_loaders_dds_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
1390-I$(top_srcdir)/src/lib/evas/include \
1391@EVAS_CFLAGS@ \
1392@evas_image_loader_dds_cflags@
1393modules_evas_loaders_dds_module_la_LIBADD = \
1394@USE_EVAS_LIBS@ \
1395@evas_image_loader_dds_libs@
1396modules_evas_loaders_dds_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
1397modules_evas_loaders_dds_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
1398modules_evas_loaders_dds_module_la_LIBTOOLFLAGS = --tag=disable-static
1399endif
1400endif
1401
1375if BUILD_LOADER_EET 1402if BUILD_LOADER_EET
1376if EVAS_STATIC_BUILD_EET 1403if EVAS_STATIC_BUILD_EET
1377lib_evas_libevas_la_SOURCES += modules/evas/loaders/eet/evas_image_load_eet.c modules/evas/savers/eet/evas_image_save_eet.c 1404lib_evas_libevas_la_SOURCES += modules/evas/loaders/eet/evas_image_load_eet.c modules/evas/savers/eet/evas_image_save_eet.c
diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c
index 7d23d45963..5d1a8acdee 100644
--- a/src/lib/evas/file/evas_module.c
+++ b/src/lib/evas/file/evas_module.c
@@ -125,6 +125,7 @@ EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_x11);
125 125
126#if !EVAS_MODULE_NO_IMAGE_LOADERS 126#if !EVAS_MODULE_NO_IMAGE_LOADERS
127EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, bmp); 127EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, bmp);
128EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, dds);
128EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, eet); 129EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, eet);
129EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, generic); 130EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, generic);
130EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, gif); 131EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, gif);
@@ -189,6 +190,9 @@ static const struct {
189#ifdef EVAS_STATIC_BUILD_BMP 190#ifdef EVAS_STATIC_BUILD_BMP
190 EVAS_EINA_STATIC_MODULE_USE(image_loader, bmp), 191 EVAS_EINA_STATIC_MODULE_USE(image_loader, bmp),
191#endif 192#endif
193#ifdef EVAS_STATIC_BUILD_DDS
194 EVAS_EINA_STATIC_MODULE_USE(image_loader, dds),
195#endif
192#ifdef EVAS_STATIC_BUILD_EET 196#ifdef EVAS_STATIC_BUILD_EET
193 EVAS_EINA_STATIC_MODULE_USE(image_loader, eet), 197 EVAS_EINA_STATIC_MODULE_USE(image_loader, eet),
194#endif 198#endif
diff --git a/src/modules/evas/loaders/dds/evas_image_load_dds.c b/src/modules/evas/loaders/dds/evas_image_load_dds.c
new file mode 100644
index 0000000000..356fc68443
--- /dev/null
+++ b/src/modules/evas/loaders/dds/evas_image_load_dds.c
@@ -0,0 +1,153 @@
1/* @file evas_image_load_dds.c
2 * @author Jean-Philippe ANDRE <jpeg@videolan.org>
3 *
4 * Load Microsoft DirectDraw Surface files.
5 * Decode S3TC image format.
6 */
7
8#ifdef HAVE_CONFIG_H
9# include "config.h"
10#endif
11
12#include "Evas_Loader.h"
13
14typedef struct _Evas_Loader_Internal Evas_Loader_Internal;
15struct _Evas_Loader_Internal
16{
17 Eina_File *f;
18};
19
20static void *
21evas_image_load_file_open_dds(Eina_File *f, Eina_Stringshare *key EINA_UNUSED,
22 Evas_Image_Load_Opts *opts,
23 Evas_Image_Animated *animated EINA_UNUSED,
24 int *error)
25{
26 Evas_Loader_Internal *loader;
27
28 // TODO: Check file size
29 if (eina_file_size_get(f) <= 16)
30 {
31 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
32 return NULL;
33 }
34
35 loader = calloc(1, sizeof (Evas_Loader_Internal));
36 if (!loader)
37 {
38 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
39 return NULL;
40 }
41
42
43 loader->f = eina_file_dup(f);
44 if (!loader->f)
45 {
46 free(loader);
47 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
48 return NULL;
49 }
50
51 return loader;
52}
53
54static void
55evas_image_load_file_close_dds(void *loader_data)
56{
57 Evas_Loader_Internal *loader = loader_data;
58
59 eina_file_close(loader->f);
60 free(loader);
61}
62
63static Eina_Bool
64evas_image_load_file_head_dds(void *loader_data,
65 Evas_Image_Property *prop,
66 int *error)
67{
68 Evas_Loader_Internal *loader = loader_data;
69 const char *m;
70
71 m = eina_file_map_all(loader->f, EINA_FILE_SEQUENTIAL);
72 if (!m)
73 {
74 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
75 return EINA_FALSE;
76 }
77
78 if (strncmp(m, "DDS ", 4) != 0)
79 {
80 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
81 return EINA_FALSE;
82 }
83
84 // TODO
85
86 return EINA_TRUE;
87}
88
89Eina_Bool
90evas_image_load_file_data_dds(void *loader_data,
91 Evas_Image_Property *prop,
92 void *pixels,
93 int *error)
94{
95 Evas_Loader_Internal *loader = loader_data;
96 const char *m;
97
98 Eina_Bool r = EINA_FALSE;
99
100 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
101
102 m = eina_file_map_all(loader->f, EINA_FILE_WILLNEED);
103 if (!m) return EINA_FALSE;
104
105 // TODO
106
107 r = EINA_TRUE;
108
109on_error:
110 eina_file_map_free(loader->f, m);
111 return r;
112}
113
114Evas_Image_Load_Func evas_image_load_dds_func =
115{
116 evas_image_load_file_open_dds,
117 evas_image_load_file_close_dds,
118 evas_image_load_file_head_dds,
119 evas_image_load_file_data_dds,
120 NULL,
121 EINA_TRUE,
122 EINA_FALSE
123};
124
125static int
126module_open(Evas_Module *em)
127{
128 if (!em) return 0;
129 em->functions = (void *)(&evas_image_load_dds_func);
130 return 1;
131}
132
133static void
134module_close(Evas_Module *em EINA_UNUSED)
135{
136}
137
138static Evas_Module_Api evas_modapi =
139{
140 EVAS_MODULE_API_VERSION,
141 "dds",
142 "none",
143 {
144 module_open,
145 module_close
146 }
147};
148
149EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_IMAGE_LOADER, image_loader, dds);
150
151#ifndef EVAS_STATIC_BUILD_DDS
152EVAS_EINA_MODULE_DEFINE(image_loader, dds);
153#endif