hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=07521f5e076f4489301190d1aa23711493871584
commit 07521f5e076f4489301190d1aa23711493871584 Author: Hermet Park <hermetp...@gmail.com> Date: Wed Jan 9 13:56:15 2019 +0900 evas vg: refactor internal function name. Specify explict svg name in vg common function since the function totally depends on svg spec. No logic changes. --- src/Makefile_Evas.am | 6 +++--- src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c | 2 +- src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c | 2 +- src/modules/evas/vg_savers/eet/evas_vg_save_eet.c | 4 ++-- src/modules/evas/vg_savers/svg/evas_vg_save_svg.c | 2 +- src/static_libs/vg_common/meson.build | 2 +- src/static_libs/vg_common/vg_common.h | 9 ++++---- .../vg_common/{vg_common.c => vg_common_svg.c} | 24 +++++++++------------- 8 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 315ada5044..12f9b31fd5 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1456,7 +1456,7 @@ endif 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 modules/evas/vg_savers/svg/evas_vg_save_svg.c \ -static_libs/vg_common/vg_common.c \ +static_libs/vg_common/vg_common_svg.c \ static_libs/vg_common/vg_common.h lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/static_libs/vg_common \ @evas_vg_loader_svg_cflags@ @@ -1471,7 +1471,7 @@ 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 \ -static_libs/vg_common/vg_common.c \ +static_libs/vg_common/vg_common_svg.c \ static_libs/vg_common/vg_common.h modules_evas_vg_loaders_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/include \ @@ -1494,7 +1494,7 @@ install_vgsaversvgpkgLTLIBRARIES = install-vgloadersvgpkgLTLIBRARIES $(install_vgsaversvgpkgLTLIBRARIES): install-libLTLIBRARIES modules_evas_vg_savers_svg_module_la_SOURCES = modules/evas/vg_savers/svg/evas_vg_save_svg.c \ -static_libs/vg_common/vg_common.c \ +static_libs/vg_common/vg_common_svg.c \ static_libs/vg_common/vg_common.h modules_evas_vg_savers_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/include \ diff --git a/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c b/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c index 746f2253b9..3b83b2f541 100644 --- a/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c +++ b/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c @@ -38,7 +38,7 @@ evas_vg_load_file_open_eet(const char *file, const char *key, int *error EINA_UN { *error = EVAS_LOAD_ERROR_NONE; } - return vg_common_create_vg_node(node); + return vg_common_svg_create_vg_node(node); } static Eina_Bool diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c index 340758afd3..25e72feb87 100644 --- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c +++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c @@ -2384,7 +2384,7 @@ evas_vg_load_file_open_svg(const char *file, const char *key EINA_UNUSED, int *e } free(loader.svg_parse); eina_file_close(f); - return vg_common_create_vg_node(loader.doc); + return vg_common_svg_create_vg_node(loader.doc); } static Evas_Vg_Load_Func evas_vg_load_svg_func = 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 index c0166d33eb..54f35e1127 100644 --- a/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c +++ b/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c @@ -24,7 +24,7 @@ evas_vg_save_file_eet(Vg_File_Data *evg_data, const char *file, const char *key, return EVAS_LOAD_ERROR_GENERIC; svg_node_eet = vg_common_svg_node_eet(); - root = vg_common_create_svg_node(evg_data); + root = vg_common_svg_create_svg_node(evg_data); eet_data_write(ef, svg_node_eet, key, root, compress); eet_close(ef); @@ -71,4 +71,4 @@ EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_SAVER, vg_saver, eet); #ifndef EVAS_STATIC_BUILD_VG_EET EVAS_EINA_MODULE_DEFINE(vg_saver, eet); -#endif \ No newline at end of file +#endif diff --git a/src/modules/evas/vg_savers/svg/evas_vg_save_svg.c b/src/modules/evas/vg_savers/svg/evas_vg_save_svg.c index 24433c262a..cf7854d80b 100644 --- a/src/modules/evas/vg_savers/svg/evas_vg_save_svg.c +++ b/src/modules/evas/vg_savers/svg/evas_vg_save_svg.c @@ -141,7 +141,7 @@ evas_vg_save_file_svg(Vg_File_Data *evg_data, const char *file, const char *key return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; } - root = vg_common_create_svg_node(evg_data); + root = vg_common_svg_create_svg_node(evg_data); buf = eina_strbuf_new(); _svg_node_printf(root, buf); fprintf(f, "%s\n", eina_strbuf_string_get(buf)); diff --git a/src/static_libs/vg_common/meson.build b/src/static_libs/vg_common/meson.build index eeb72fce52..648fcd5570 100644 --- a/src/static_libs/vg_common/meson.build +++ b/src/static_libs/vg_common/meson.build @@ -1,7 +1,7 @@ #vg common is not really a static lib, is required by evas and requires evas ... so only collecting src here and compile them into evas ... ... vg_common_src = files([ - 'vg_common.c', + 'vg_common_svg.c', 'vg_common.h', ]) diff --git a/src/static_libs/vg_common/vg_common.h b/src/static_libs/vg_common/vg_common.h index 174cb2003e..ab0cb0ded3 100644 --- a/src/static_libs/vg_common/vg_common.h +++ b/src/static_libs/vg_common/vg_common.h @@ -8,6 +8,9 @@ #include "evas_common_private.h" #include "evas_private.h" +/****************************************************************************************** + * SVG Compatible feature implementation + ******************************************************************************************/ typedef enum _Svg_Node_Type Svg_Node_Type; typedef enum _Svg_Length_Type Svg_Length_Type; @@ -25,13 +28,11 @@ typedef struct _Svg_Style_Property Svg_Style_Property; typedef struct _Svg_Line_Node Svg_Line_Node; typedef struct _Svg_Custom_Command_Node Svg_Custom_Command_Node; - typedef struct _Svg_Style_Stroke Svg_Style_Stroke; typedef struct _Svg_Style_Fill Svg_Style_Fill; typedef enum _Svg_Fill_Flags Svg_Fill_Flags; typedef enum _Svg_Stroke_Flags Svg_Stroke_Flags; - typedef enum _Svg_Gradient_Type Svg_Gradient_Type; typedef struct _Svg_Style_Gradient Svg_Style_Gradient; typedef struct _Svg_Linear_Gradient Svg_Linear_Gradient; @@ -312,8 +313,8 @@ enum _Svg_Style_Type Eet_Data_Descriptor * vg_common_svg_node_eet(void); void vg_common_svg_node_eet_destroy(void); -Vg_File_Data * vg_common_create_vg_node(Svg_Node *node); -Svg_Node * vg_common_create_svg_node(Vg_File_Data *node); +Vg_File_Data * vg_common_svg_create_vg_node(Svg_Node *node); +Svg_Node *vg_common_svg_create_svg_node(Vg_File_Data *node); void vg_common_svg_node_free(Svg_Node *node); #endif //EVAS_VG_COMMON_H_ diff --git a/src/static_libs/vg_common/vg_common.c b/src/static_libs/vg_common/vg_common_svg.c similarity index 98% rename from src/static_libs/vg_common/vg_common.c rename to src/static_libs/vg_common/vg_common_svg.c index 1eb5b5831f..eba876e160 100644 --- a/src/static_libs/vg_common/vg_common.c +++ b/src/static_libs/vg_common/vg_common_svg.c @@ -7,8 +7,6 @@ #include <Eet.h> #include <Evas.h> - - Eet_Data_Descriptor *_eet_rect_node = NULL; Eet_Data_Descriptor *_eet_circle_node = NULL; Eet_Data_Descriptor *_eet_ellipse_node = NULL; @@ -333,7 +331,7 @@ _eet_for_path_node(void) return eet; } -struct +static struct { Svg_Node_Type u; const char *name; @@ -354,8 +352,6 @@ struct }; static const char * -/* union - type_get() */ _union_type_get(const void *data, Eina_Bool *unknow) { @@ -372,7 +368,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 +388,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 +446,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); @@ -612,10 +608,10 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Efl_VG *parent, Vg_F efl_gfx_path_bounds_get(grad_obj, &grad_geom); - double cy = (grad_geom.h / 2.0) + grad_geom.y; - double cy_scaled = (grad_geom.h / 2.0) * scale_reversed_Y; - double cx = (grad_geom.w / 2.0) + grad_geom.x; - double cx_scaled = (grad_geom.w / 2.0) * scale_reversed_X; + double cy = (grad_geom.h / 2) + grad_geom.y; + double cy_scaled = (grad_geom.h / 2) * scale_reversed_Y; + double cx = grad_geom.w / 2 + grad_geom.x; + double cx_scaled = (grad_geom.w / 2) * scale_reversed_X; /* matrix tranformation of gradient figure: * 0. we remember size of gradient and it's center point @@ -820,7 +816,7 @@ vg_common_create_vg_node_helper(Svg_Node *node, Efl_VG *parent, Vg_File_Data *vg } Vg_File_Data * -vg_common_create_vg_node(Svg_Node *node) +vg_common_svg_create_vg_node(Svg_Node *node) { Vg_File_Data *vg_data; @@ -1013,7 +1009,7 @@ vg_common_create_svg_node_helper(Efl_VG *vg, Svg_Node *parent) } Svg_Node * -vg_common_create_svg_node(Vg_File_Data *node) +vg_common_svg_create_svg_node(Vg_File_Data *node) { Svg_Node *doc; --