From 8b7f060946a4268316792902409bda2fea00fd32 Mon Sep 17 00:00:00 2001 From: Subhransu Mohanty Date: Fri, 14 Oct 2016 15:52:51 +0900 Subject: [PATCH] evas/module: add a new module in vg_saver for eet Reviewers: cedric, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4350 --- src/Makefile_Evas.am | 23 ++++++++- src/lib/evas/Evas_Loader.h | 3 +- src/lib/evas/file/evas_module.c | 27 ++++++++-- src/lib/evas/include/evas_private.h | 5 ++ src/modules/evas/vg_savers/eet/evas_vg_save_eet.c | 60 +++++++++++++++++++++++ 5 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 src/modules/evas/vg_savers/eet/evas_vg_save_eet.c diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 6fcb319..26cdd79 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1501,6 +1501,7 @@ bin_evas_evas_cserve2_slave_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -DEVAS_MODULE_NO_ENGINES=1 \ -DEVAS_MODULE_NO_IMAGE_SAVERS=1 \ -DEVAS_MODULE_NO_VG_LOADERS=1 \ +-DEVAS_MODULE_NO_VG_SAVERS=1 \ @EVAS_CFLAGS@ bin_evas_evas_cserve2_slave_LDADD = @EVAS_CSERVE2_SLAVE_LIBS@ @USE_EINA_LIBS@ @USE_EMILE_LIBS@ @@ -1556,7 +1557,7 @@ endif if BUILD_VG_LOADER_EET if EVAS_STATIC_BUILD_VG_EET -lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/eet/evas_vg_load_eet.c +lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/eet/evas_vg_load_eet.c modules/evas/vg_savers/eet/evas_vg_save_eet.c lib_evas_libevas_la_CPPFLAGS += @evas_vg_loader_eet_cflags@ lib_evas_libevas_la_LIBADD += @evas_vg_loader_eet_libs@ else @@ -1579,6 +1580,26 @@ modules_evas_vg_loaders_eet_module_la_LIBADD = \ modules_evas_vg_loaders_eet_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ modules_evas_vg_loaders_eet_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ modules_evas_vg_loaders_eet_module_la_LIBTOOLFLAGS = --tag=disable-static + +vgsavereetpkgdir = $(libdir)/evas/modules/vg_savers/eet/$(MODULE_ARCH) +vgsavereetpkg_LTLIBRARIES = modules/evas/vg_savers/eet/module.la + +# Workaround for broken parallel install support in automake (relink issue) +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328 +install_vgsavereetpkgLTLIBRARIES = install-vgloadereetpkgLTLIBRARIES +$(install_vgsavereetpkgLTLIBRARIES): install-libLTLIBRARIES + +modules_evas_vg_savers_eet_module_la_SOURCES = modules/evas/vg_savers/eet/evas_vg_save_eet.c +modules_evas_vg_savers_eet_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ +-I$(top_srcdir)/src/lib/evas/include \ +@EVAS_CFLAGS@ \ +@evas_vg_saver_eet_cflags@ +modules_evas_vg_savers_eet_module_la_LIBADD = \ +@USE_EVAS_LIBS@ \ +@evas_vg_saver_eet_libs@ +modules_evas_vg_savers_eet_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ +modules_evas_vg_savers_eet_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ +modules_evas_vg_savers_eet_module_la_LIBTOOLFLAGS = --tag=disable-static endif endif diff --git a/src/lib/evas/Evas_Loader.h b/src/lib/evas/Evas_Loader.h index b414014..a5d138b 100644 --- a/src/lib/evas/Evas_Loader.h +++ b/src/lib/evas/Evas_Loader.h @@ -79,7 +79,8 @@ typedef enum _Evas_Module_Type EVAS_MODULE_TYPE_IMAGE_LOADER = 1, EVAS_MODULE_TYPE_IMAGE_SAVER = 2, EVAS_MODULE_TYPE_OBJECT = 3, - EVAS_MODULE_TYPE_VG_LOADER = 4 + EVAS_MODULE_TYPE_VG_LOADER = 4, + EVAS_MODULE_TYPE_VG_SAVER = 5 } Evas_Module_Type; typedef struct _Evas_Module_Api Evas_Module_Api; diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c index ea4f5c2..612507d 100644 --- a/src/lib/evas/file/evas_module.c +++ b/src/lib/evas/file/evas_module.c @@ -24,8 +24,13 @@ #define EVAS_MODULE_NO_VG_LOADERS 0 #endif +#ifndef EVAS_MODULE_NO_VG_SAVERS +#define EVAS_MODULE_NO_VG_SAVERS 0 +#endif + -static Eina_Hash *evas_modules[5] = { +static Eina_Hash *evas_modules[6] = { + NULL, NULL, NULL, NULL, @@ -155,6 +160,10 @@ EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, xpm); EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, tgv); #endif +#if !EVAS_MODULE_NO_VG_SAVERS +EVAS_EINA_STATIC_MODULE_DEFINE(vg_saver, eet); +#endif + #if !EVAS_MODULE_NO_IMAGE_SAVERS EVAS_EINA_STATIC_MODULE_DEFINE(image_saver, eet); EVAS_EINA_STATIC_MODULE_DEFINE(image_saver, jpeg); @@ -264,6 +273,11 @@ static const struct { EVAS_EINA_STATIC_MODULE_USE(image_loader, tgv), #endif #endif +#if !EVAS_MODULE_NO_VG_SAVERS +#ifdef EVAS_STATIC_BUILD_VG_EET + EVAS_EINA_STATIC_MODULE_USE(vg_saver, eet), +#endif +#endif #if !EVAS_MODULE_NO_IMAGE_SAVERS #ifdef EVAS_STATIC_BUILD_EET EVAS_EINA_STATIC_MODULE_USE(image_saver, eet), @@ -301,6 +315,7 @@ evas_module_init(void) evas_modules[EVAS_MODULE_TYPE_IMAGE_SAVER] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL); evas_modules[EVAS_MODULE_TYPE_OBJECT] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL); evas_modules[EVAS_MODULE_TYPE_VG_LOADER] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL); + evas_modules[EVAS_MODULE_TYPE_VG_SAVER] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL); evas_engines = eina_array_new(4); @@ -313,7 +328,7 @@ evas_module_register(const Evas_Module_Api *module, Evas_Module_Type type) { Evas_Module *em; - if ((unsigned int)type > 3) return EINA_FALSE; + if ((unsigned int)type > 5) return EINA_FALSE; if (!module) return EINA_FALSE; if (module->version != EVAS_MODULE_API_VERSION) return EINA_FALSE; @@ -415,7 +430,7 @@ evas_module_unregister(const Evas_Module_Api *module, Evas_Module_Type type) { Evas_Module *em; - if ((unsigned int)type > 3) return EINA_FALSE; + if ((unsigned int)type > 5) return EINA_FALSE; if (!module) return EINA_FALSE; em = eina_hash_find(evas_modules[type], module->name); @@ -454,7 +469,7 @@ evas_module_find_type(Evas_Module_Type type, const char *name) Eina_List *l; Eina_Bool run_in_tree; - if ((unsigned int)type > 3) return NULL; + if ((unsigned int)type > 5) return NULL; em = eina_hash_find(evas_modules[type], name); if (em) @@ -475,6 +490,7 @@ evas_module_find_type(Evas_Module_Type type, const char *name) case EVAS_MODULE_TYPE_IMAGE_SAVER: type_str = "image_savers"; break; case EVAS_MODULE_TYPE_OBJECT: type_str = "object"; break; case EVAS_MODULE_TYPE_VG_LOADER: type_str = "vg_loaders"; break; + case EVAS_MODULE_TYPE_VG_SAVER: type_str = "vg_savers"; break; } buffer[0] = '\0'; @@ -677,6 +693,7 @@ evas_module_shutdown(void) eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_IMAGE_SAVER], _cb_mod_close, NULL); eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_OBJECT], _cb_mod_close, NULL); eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_VG_LOADER], _cb_mod_close, NULL); + eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_VG_SAVER], _cb_mod_close, NULL); eina_hash_free(evas_modules[EVAS_MODULE_TYPE_ENGINE]); evas_modules[EVAS_MODULE_TYPE_ENGINE] = NULL; @@ -688,6 +705,8 @@ evas_module_shutdown(void) evas_modules[EVAS_MODULE_TYPE_OBJECT] = NULL; eina_hash_free(evas_modules[EVAS_MODULE_TYPE_VG_LOADER]); evas_modules[EVAS_MODULE_TYPE_VG_LOADER] = NULL; + eina_hash_free(evas_modules[EVAS_MODULE_TYPE_VG_SAVER]); + evas_modules[EVAS_MODULE_TYPE_VG_SAVER] = NULL; EINA_LIST_FREE(evas_module_paths, path) free(path); diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index cb6d75f..1106e67 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -69,6 +69,7 @@ typedef struct _Evas_Data_Node Evas_Data_Node; typedef struct _Evas_Func Evas_Func; typedef struct _Evas_Image_Save_Func Evas_Image_Save_Func; typedef struct _Evas_Vg_Load_Func Evas_Vg_Load_Func; +typedef struct _Evas_Vg_Save_Func Evas_Vg_Save_Func; typedef struct _Evas_Object_Func Evas_Object_Func; typedef struct _Evas_Intercept_Func Evas_Intercept_Func; typedef struct _Evas_Key_Grab Evas_Key_Grab; @@ -1518,6 +1519,10 @@ struct _Evas_Vg_Load_Func void *(*file_data) (Eina_File *f, Eina_Stringshare *key, int *error); }; +struct _Evas_Vg_Save_Func +{ + int (*vg_save) (void *vg, const char *file, const char *key, int compress); +}; #ifdef __cplusplus extern "C" { diff --git a/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c b/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c new file mode 100644 index 0000000..700c55b --- /dev/null +++ b/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c @@ -0,0 +1,60 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "evas_common_private.h" +#include "evas_private.h" + +static int _evas_vg_saver_eet_log_dom = -1; + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_evas_vg_saver_eet_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_evas_vg_saver_eet_log_dom, __VA_ARGS__) + +int +evas_vg_save_file_eet(void *vg EINA_UNUSED, const char *file EINA_UNUSED, const char *key EINA_UNUSED, int compress EINA_UNUSED) +{ + INF("No Implementation Yet"); + return 0; +} + +static Evas_Vg_Save_Func evas_vg_save_eet_func = +{ + evas_vg_save_file_eet +}; + +static int +module_open(Evas_Module *em) +{ + if (!em) return 0; + em->functions = (void *)(&evas_vg_save_eet_func); + return 1; +} + +static void +module_close(Evas_Module *em EINA_UNUSED) +{ +} + +static Evas_Module_Api evas_modapi = +{ + EVAS_MODULE_API_VERSION, + "eet", + "none", + { + module_open, + module_close + } +}; + +EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_LOADER, vg_saver, eet); + +#ifndef EVAS_STATIC_BUILD_VG_EET +EVAS_EINA_MODULE_DEFINE(vg_saver, eet); +#endif \ No newline at end of file -- 2.7.4