From: Hermet Park Date: Tue, 21 Aug 2018 10:41:31 +0000 (+0900) Subject: evas json: new feature for lottie - #1 X-Git-Tag: submit/tizen/20180919.084736~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F50%2F189150%2F1;p=platform%2Fupstream%2Fefl.git evas json: new feature for lottie - #1 set up infrastructure for json loader. @feature Change-Id: I1a12ad306da2db9b90150a9df5d9e49b5e0e5f7e --- diff --git a/configure.ac b/configure.ac index 00ef941..5e77bd6 100755 --- a/configure.ac +++ b/configure.ac @@ -2591,7 +2591,7 @@ esac ARG_ENABLE_EVAS_VG_LOADER(SVG, static) ARG_ENABLE_EVAS_VG_LOADER(EET, static) - +ARG_ENABLE_EVAS_VG_LOADER(JSON, static) ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static) ARG_ENABLE_EVAS_IMAGE_LOADER(Eet, static) @@ -2886,6 +2886,7 @@ AM_CONDITIONAL([BUILD_ENGINE_WAYLAND_COMMON], [test "x${have_evas_engine_wayland EVAS_CHECK_VG_LOADER([SVG], [${want_evas_vg_loader_svg}]) EVAS_CHECK_VG_LOADER([EET], [${want_evas_vg_loader_eet}]) +EVAS_CHECK_VG_LOADER([JSON], [${want_evas_vg_loader_json}]) ## Image Loaders @@ -3076,9 +3077,9 @@ AC_ARG_ENABLE([xcf], ]) have_poppler="no" -have_spectre="no" have_raw="no" have_rsvg="no" +have_spectre="no" ### Check needed dependency for each generic loader if test "x${want_poppler}" = "xyes"; then @@ -3116,6 +3117,7 @@ EFL_ADD_FEATURE([EVAS_LOADER], [raw], [${have_raw}]) EFL_ADD_FEATURE([EVAS_LOADER], [rsvg], [${have_rsvg}]) EFL_ADD_FEATURE([EVAS_LOADER], [xcf], [${want_xcf}]) + EFL_LIB_END([Evas]) #### End of Evas diff --git a/m4/evas_check_loader.m4 b/m4/evas_check_loader.m4 index ff48c3c..22cb0e1 100644 --- a/m4/evas_check_loader.m4 +++ b/m4/evas_check_loader.m4 @@ -58,6 +58,22 @@ AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4]) ]) +dnl use: EVAS_CHECK_VG_LOADER_DEP_JSON(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) + +AC_DEFUN([EVAS_CHECK_VG_LOADER_DEP_JSON], +[ + +have_dep="yes" +evas_vg_loader_[]$1[]_cflags="" +evas_vg_loader_[]$1[]_libs="-llottie-player" + +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], diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index b66df5f..fdcc3fe 100755 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1635,6 +1635,33 @@ modules_evas_vg_savers_eet_module_la_LIBTOOLFLAGS = --tag=disable-static endif endif +if BUILD_VG_LOADER_JSON +if EVAS_STATIC_BUILD_VG_JSON +lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/json/evas_vg_load_json.c +lib_evas_libevas_la_CPPFLAGS += @evas_vg_loader_json_cflags@ +lib_evas_libevas_la_LIBADD += @evas_vg_loader_json_libs@ +else +vgloaderjsonpkgdir = $(libdir)/evas/modules/vg_loaders/json/$(MODULE_ARCH) +vgloaderjsonpkg_LTLIBRARIES = modules/evas/vg_loaders/json/module.la + +# Workaround for broken parallel install support in automake (relink issue) +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328 +install_vgloaderjsonpkgLTLIBRARIES = install-vgloaderjsonpkgLTLIBRARIES +$(install_vgloaderjsonpkgLTLIBRARIES): install-libLTLIBRARIES + +modules_evas_vg_loaders_json_module_la_SOURCES = modules/evas/vg_loaders/json/evas_vg_load_json.c +modules_evas_vg_loaders_json_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ +-I$(top_srcdir)/src/lib/evas/include \ +@EVAS_CFLAGS@ \ +@evas_vg_loader_json_cflags@ +modules_evas_vg_loaders_json_module_la_LIBADD = \ +@USE_EVAS_LIBS@ \ +@evas_vg_loader_json_libs@ +modules_evas_vg_loaders_json_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ +modules_evas_vg_loaders_json_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ +modules_evas_vg_loaders_json_module_la_LIBTOOLFLAGS = --tag=disable-static +endif +endif if BUILD_LOADER_BMP if EVAS_STATIC_BUILD_BMP diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c index 63129bc..b467ebc 100644 --- a/src/lib/evas/file/evas_module.c +++ b/src/lib/evas/file/evas_module.c @@ -185,6 +185,7 @@ EVAS_EINA_STATIC_MODULE_DEFINE(engine, wayland_egl); #if !EVAS_MODULE_NO_VG_LOADERS EVAS_EINA_STATIC_MODULE_DEFINE(vg_loader, eet); EVAS_EINA_STATIC_MODULE_DEFINE(vg_loader, svg); +EVAS_EINA_STATIC_MODULE_DEFINE(vg_loader, json); #endif #if !EVAS_MODULE_NO_IMAGE_LOADERS @@ -274,6 +275,9 @@ static const struct { #ifdef EVAS_STATIC_BUILD_VG_EET EVAS_EINA_STATIC_MODULE_USE(vg_loader, eet), #endif +#ifdef EVAS_STATIC_BUILD_VG_JSON + EVAS_EINA_STATIC_MODULE_USE(vg_loader, json), +#endif #endif #if !EVAS_MODULE_NO_IMAGE_LOADERS #ifdef EVAS_STATIC_BUILD_BMP diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c index f628a78..c00dd25 100644 --- a/src/lib/evas/vg/evas_vg_cache.c +++ b/src/lib/evas/vg/evas_vg_cache.c @@ -28,7 +28,7 @@ static const struct ext_loader_s loaders[] = static const char *loaders_name[] = { /* in order of most likely needed */ - "eet", "svg" + "eet", "json", "svg" }; static Evas_Module * @@ -63,10 +63,11 @@ _vg_load_from_file(const char *file, const char *key) int error = EVAS_LOAD_ERROR_GENERIC; Vg_File_Data *evg_data = NULL; unsigned int i; - +ERR("file = %s", file); em = _find_loader_module(file); if (em) { + ERR("oh, em %p", em); loader = em->functions; evg_data = loader->file_data(file, key, &error); } @@ -75,6 +76,7 @@ _vg_load_from_file(const char *file, const char *key) for (i = 0; i < sizeof (loaders_name) / sizeof (char *); i++) { em = evas_module_find_type(EVAS_MODULE_TYPE_VG_LOADER, loaders_name[i]); + ERR("found? = %p", em); if (em) { loader = em->functions; diff --git a/src/modules/evas/vg_loaders/json/evas_vg_load_json.c b/src/modules/evas/vg_loaders/json/evas_vg_load_json.c new file mode 100644 index 0000000..e9f772c --- /dev/null +++ b/src/modules/evas/vg_loaders/json/evas_vg_load_json.c @@ -0,0 +1,82 @@ +#include +#include "vg_common.h" + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_evas_vg_loader_json_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_evas_vg_loader_json_log_dom, __VA_ARGS__) + +static int _evas_vg_loader_json_log_dom = -1; +static LOTPlayer *player = NULL; + +static Vg_File_Data* +evas_vg_load_file_data_json(const char *file, + const char *key EINA_UNUSED, + int *error EINA_UNUSED) +{ + lotplayer_set_file(player, file); + ERR("lotplayer file set = %s", file); + return NULL; +} + +static Evas_Vg_Load_Func evas_vg_load_json_func = +{ + evas_vg_load_file_data_json +}; + +static int +module_open(Evas_Module *em) +{ + if (!em) return 0; + em->functions = (void *)(&evas_vg_load_json_func); + _evas_vg_loader_json_log_dom = eina_log_domain_register + ("vg-load-json", EVAS_DEFAULT_LOG_COLOR); + if (_evas_vg_loader_json_log_dom < 0) + { + EINA_LOG_ERR("Can not create a module log domain."); + return 0; + } + + player = lotplayer_create(); + lotplayer_set_size(player, 400, 400); + ERR("init lotplayer! = %p", player); + + return 1; +} + +static void +module_close(Evas_Module *em EINA_UNUSED) +{ + lotplayer_destroy(player); + ERR("destroy lotplayer! = %p", player); + + player = NULL; + + if (_evas_vg_loader_json_log_dom >= 0) + { + eina_log_domain_unregister(_evas_vg_loader_json_log_dom); + _evas_vg_loader_json_log_dom = -1; + } +} + +static Evas_Module_Api evas_modapi = +{ + EVAS_MODULE_API_VERSION, + "json", + "none", + { + module_open, + module_close + } +}; + +EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_LOADER, vg_loader, json); + +#ifndef EVAS_STATIC_BUILD_VG_JSON +EVAS_EINA_MODULE_DEFINE(vg_loader, json); +#endif diff --git a/src/static_libs/vg_common/vg_common.c b/src/static_libs/vg_common/vg_common.c index eb8a293..4c59d0e 100644 --- a/src/static_libs/vg_common/vg_common.c +++ b/src/static_libs/vg_common/vg_common.c @@ -333,7 +333,7 @@ _eet_for_path_node(void) return eet; } -struct +static struct { Svg_Node_Type u; const char *name; @@ -354,8 +354,6 @@ struct }; static const char * -/* union - type_get() */ _union_type_get(const void *data, Eina_Bool *unknow) { @@ -372,7 +370,7 @@ _union_type_get(const void *data, if (unknow) *unknow = EINA_TRUE; return NULL; -} /* _union_type_get */ +} static Eina_Bool _union_type_set(const char *type, @@ -392,7 +390,7 @@ _union_type_set(const char *type, return EINA_TRUE; } return EINA_FALSE; -} /* _union_type_set */ +} Eet_Data_Descriptor * vg_common_svg_node_eet(void) @@ -450,7 +448,7 @@ vg_common_svg_node_eet(void) return _eet_vg_node; } -void +void vg_common_svg_node_eet_destroy(void) { FREE_DESCRIPTOR(_eet_rect_node);