evas/module: Added a new module vg_loader for svg

Reviewers: cedric, jpeg

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4346
This commit is contained in:
Subhransu Mohanty 2016-10-12 18:39:10 +09:00 committed by Jean-Philippe Andre
parent bdf79fa8f0
commit 0d9b168146
7 changed files with 226 additions and 2 deletions

View File

@ -2390,6 +2390,8 @@ case "$host_os" in
;;
esac
ARG_ENABLE_EVAS_VG_LOADER(SVG, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(Eet, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(Generic, [${want_generic}])
@ -2708,6 +2710,9 @@ fi
AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_COMMON], [test "x${have_static_evas_engine_gl_common}" = "xyes"])
## Vg Loaders
EVAS_CHECK_VG_LOADER([SVG], [${want_evas_vg_loader_svg}])
## Image Loaders
@ -5994,6 +5999,7 @@ echo "Emile...........: yes (${features_emile})"
echo "Eet.............: yes"
echo "Evas............: yes (${features_evas})"
echo " Engines.......: ${features_evas_engine}"
echo " Vg Loaders : ${features_evas_vg_loader}"
echo " Image Loaders.: ${features_evas_loader}"
if test "x${have_pixman}" = "xyes" ; then
echo " Pixman........: ${features_evas_pixman}"

View File

@ -1,4 +1,47 @@
dnl use: ARG_ENABLE_EVAS_VG_LOADER(loader, default_value)
AC_DEFUN([ARG_ENABLE_EVAS_VG_LOADER],
[dnl
m4_pushdef([DOWN], m4_tolower([$1]))dnl
AC_ARG_ENABLE([vg-loader-[]DOWN],
[AC_HELP_STRING([--enable-vg-loader-[]DOWN], [enable $1 vg loader. @<:@default=$2@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_evas_vg_loader_[]DOWN="yes"
else
if test "x${enableval}" = "xstatic" ; then
want_evas_vg_loader_[]DOWN="static"
else
if test "x${enableval}" = "xauto" ; then
want_evas_vg_loader_[]DOWN="auto"
else
want_evas_vg_loader_[]DOWN="no"
fi
fi
fi
],
[want_evas_vg_loader_[]DOWN="$2"])
m4_popdef([DOWN])dnl
])
dnl use: EVAS_CHECK_VG_LOADER_DEP_SVG(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
AC_DEFUN([EVAS_CHECK_VG_LOADER_DEP_SVG],
[
have_dep="yes"
evas_vg_loader_[]$1[]_cflags=""
evas_vg_loader_[]$1[]_libs=""
AC_SUBST([evas_vg_loader_$1_cflags])
AC_SUBST([evas_vg_loader_$1_libs])
AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4])
])
dnl use: ARG_ENABLE_EVAS_IMAGE_LOADER(loader, default_value)
AC_DEFUN([ARG_ENABLE_EVAS_IMAGE_LOADER],
@ -592,3 +635,56 @@ AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "x${want_static_loader}" = "xyes"])
m4_popdef([UP])dnl
m4_popdef([DOWN])dnl
])
dnl use: EVAS_CHECK_VG_LOADER(loader, want_loader, macro)
AC_DEFUN([EVAS_CHECK_VG_LOADER],
[dnl
m4_pushdef([UP], m4_toupper([$1]))dnl
m4_pushdef([DOWN], m4_tolower([$1]))dnl
want_loader="$2"
want_static_loader="no"
have_loader="no"
have_evas_vg_loader_[]DOWN="no"
AC_MSG_CHECKING([whether to enable $1 vg loader])
AC_MSG_RESULT([${want_loader}])
if test "x${want_loader}" = "xyes" -o "x${want_loader}" = "xstatic" -o "x${want_loader}" = "xauto"; then
m4_default([EVAS_CHECK_VG_LOADER_DEP_]m4_defn([UP]))(DOWN, ${want_loader}, [have_loader="yes"], [have_loader="no"])
fi
if test "x${have_loader}" = "xno"; then
if test "x${want_loader}" = "xyes" -o "x${want_loader}" = "xstatic"; then
AC_MSG_ERROR([$1 dependencies not found])
fi
fi
AC_MSG_CHECKING([whether $1 vg loader will be built])
AC_MSG_RESULT([${have_loader}])
if test "x${have_loader}" = "xyes" ; then
if test "x${want_loader}" = "xstatic" ; then
have_evas_vg_loader_[]DOWN="static"
want_static_loader="yes"
else
have_evas_vg_loader_[]DOWN="yes"
fi
fi
if test "x${have_loader}" = "xyes" ; then
AC_DEFINE(BUILD_VG_LOADER_[]UP, [1], [UP Image Loader Support])
fi
AM_CONDITIONAL(BUILD_VG_LOADER_[]UP, [test "x${have_loader}" = "xyes"])
if test "x${want_static_loader}" = "xyes" ; then
AC_DEFINE(EVAS_STATIC_BUILD_VG_[]UP, [1], [Build $1 vg loader inside libevas])
have_static_module="yes"
fi
EFL_ADD_FEATURE([EVAS_VG_LOADER], DOWN, [${have_evas_vg_loader_]DOWN[}])dnl
AM_CONDITIONAL(EVAS_STATIC_BUILD_VG_[]UP, [test "x${want_static_loader}" = "xyes"])dnl
m4_popdef([UP])dnl
m4_popdef([DOWN])dnl
])

View File

@ -1500,6 +1500,7 @@ bin_evas_evas_cserve2_slave_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
-DEVAS_MODULE_NO_ENGINES=1 \
-DEVAS_MODULE_NO_IMAGE_SAVERS=1 \
-DEVAS_MODULE_NO_VG_LOADERS=1 \
@EVAS_CFLAGS@
bin_evas_evas_cserve2_slave_LDADD = @EVAS_CSERVE2_SLAVE_LIBS@ @USE_EINA_LIBS@ @USE_EMILE_LIBS@
@ -1525,6 +1526,40 @@ endif
### loaders and savers
if BUILD_VG_LOADER_SVG
if EVAS_STATIC_BUILD_VG_SVG
lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/svg/evas_vg_load_svg.c
lib_evas_libevas_la_CPPFLAGS += @evas_vg_loader_svg_cflags@
lib_evas_libevas_la_LIBADD += @evas_vg_loader_svg_libs@
if EVAS_CSERVE2
bin_evas_evas_cserve2_slave_CPPFLAGS += @evas_vg_loader_svg_cflags@
bin_evas_evas_cserve2_slave_LDADD += @evas_vg_loader_svg_libs@
endif
else
vgloadersvgpkgdir = $(libdir)/evas/modules/vg_loaders/svg/$(MODULE_ARCH)
vgloadersvgpkg_LTLIBRARIES = modules/evas/vg_loaders/svg/module.la
# Workaround for broken parallel install support in automake (relink issue)
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
install_vgloadersvgpkgLTLIBRARIES = install-vgloadersvgpkgLTLIBRARIES
$(install_vgloadersvgpkgLTLIBRARIES): install-libLTLIBRARIES
modules_evas_vg_loaders_svg_module_la_SOURCES = modules/evas/vg_loaders/svg/evas_vg_load_svg.c
modules_evas_vg_loaders_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/evas/include \
@EVAS_CFLAGS@ \
@evas_vg_loader_svg_cflags@
modules_evas_vg_loaders_svg_module_la_LIBADD = \
@USE_EVAS_LIBS@ \
@evas_vg_loader_svg_libs@
modules_evas_vg_loaders_svg_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
modules_evas_vg_loaders_svg_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_evas_vg_loaders_svg_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
endif
if BUILD_LOADER_BMP
if EVAS_STATIC_BUILD_BMP
lib_evas_libevas_la_SOURCES += modules/evas/image_loaders/bmp/evas_image_load_bmp.c

View File

@ -78,7 +78,8 @@ typedef enum _Evas_Module_Type
EVAS_MODULE_TYPE_ENGINE = 0,
EVAS_MODULE_TYPE_IMAGE_LOADER = 1,
EVAS_MODULE_TYPE_IMAGE_SAVER = 2,
EVAS_MODULE_TYPE_OBJECT = 3
EVAS_MODULE_TYPE_OBJECT = 3,
EVAS_MODULE_TYPE_VG_LOADER = 4
} Evas_Module_Type;
typedef struct _Evas_Module_Api Evas_Module_Api;

View File

@ -20,8 +20,13 @@
#define EVAS_MODULE_NO_IMAGE_SAVERS 0
#endif
#ifndef EVAS_MODULE_NO_VG_LOADERS
#define EVAS_MODULE_NO_VG_LOADERS 0
#endif
static Eina_Hash *evas_modules[4] = {
static Eina_Hash *evas_modules[5] = {
NULL,
NULL,
NULL,
NULL,
@ -124,6 +129,10 @@ EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_generic);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_x11);
#endif
#if !EVAS_MODULE_NO_VG_LOADERS
EVAS_EINA_STATIC_MODULE_DEFINE(vg_loader, svg);
#endif
#if !EVAS_MODULE_NO_IMAGE_LOADERS
EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, bmp);
EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, dds);
@ -190,6 +199,11 @@ static const struct {
EVAS_EINA_STATIC_MODULE_USE(engine, software_x11),
#endif
#endif
#if !EVAS_MODULE_NO_VG_LOADERS
#ifdef EVAS_STATIC_BUILD_VG_SVG
EVAS_EINA_STATIC_MODULE_USE(vg_loader, svg),
#endif
#endif
#if !EVAS_MODULE_NO_IMAGE_LOADERS
#ifdef EVAS_STATIC_BUILD_BMP
EVAS_EINA_STATIC_MODULE_USE(image_loader, bmp),
@ -282,6 +296,7 @@ evas_module_init(void)
evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL);
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_engines = eina_array_new(4);
@ -455,6 +470,7 @@ evas_module_find_type(Evas_Module_Type type, const char *name)
case EVAS_MODULE_TYPE_IMAGE_LOADER: type_str = "image_loaders"; break;
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;
}
buffer[0] = '\0';
@ -656,6 +672,7 @@ evas_module_shutdown(void)
eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER], _cb_mod_close, NULL);
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_free(evas_modules[EVAS_MODULE_TYPE_ENGINE]);
evas_modules[EVAS_MODULE_TYPE_ENGINE] = NULL;
@ -665,6 +682,8 @@ evas_module_shutdown(void)
evas_modules[EVAS_MODULE_TYPE_IMAGE_SAVER] = NULL;
eina_hash_free(evas_modules[EVAS_MODULE_TYPE_OBJECT]);
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_LIST_FREE(evas_module_paths, path)
free(path);

View File

@ -68,6 +68,7 @@ typedef struct _Evas_Font_Description Evas_Font_Description;
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_Object_Func Evas_Object_Func;
typedef struct _Evas_Intercept_Func Evas_Intercept_Func;
typedef struct _Evas_Key_Grab Evas_Key_Grab;
@ -1512,6 +1513,12 @@ struct _Evas_Image_Save_Func
int (*image_save) (RGBA_Image *im, const char *file, const char *key, int quality, int compress, const char *encoding);
};
struct _Evas_Vg_Load_Func
{
void *(*file_data) (Eina_File *f, Eina_Stringshare *key, int *error);
};
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -0,0 +1,60 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "evas_common_private.h"
#include "evas_private.h"
static int _evas_vg_loader_svg_log_dom = -1;
#ifdef ERR
# undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_evas_vg_loader_svg_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
#endif
#define INF(...) EINA_LOG_DOM_INFO(_evas_vg_loader_svg_log_dom, __VA_ARGS__)
static void*
evas_vg_load_file_data_svg(Eina_File *f EINA_UNUSED, Eina_Stringshare *key EINA_UNUSED, int *error EINA_UNUSED)
{
INF("No Implementation Yet");
return NULL;
}
static Evas_Vg_Load_Func evas_vg_load_svg_func =
{
evas_vg_load_file_data_svg
};
static int
module_open(Evas_Module *em)
{
if (!em) return 0;
em->functions = (void *)(&evas_vg_load_svg_func);
return 1;
}
static void
module_close(Evas_Module *em EINA_UNUSED)
{
}
static Evas_Module_Api evas_modapi =
{
EVAS_MODULE_API_VERSION,
"svg",
"none",
{
module_open,
module_close
}
};
EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_LOADER, vg_loader, svg);
#ifndef EVAS_STATIC_BUILD_VG_SVG
EVAS_EINA_MODULE_DEFINE(vg_loader, svg);
#endif