evas vg: refactor internal function name.

Specify explict svg name in vg common function
since the functiona is totally depends on svg spec.

No logic changes.
This commit is contained in:
Hermet Park 2019-01-09 13:56:15 +09:00
parent 1ff024c9bb
commit 865c60373a
8 changed files with 24 additions and 27 deletions

View File

@ -1456,7 +1456,7 @@ endif
if BUILD_VG_LOADER_SVG if BUILD_VG_LOADER_SVG
if EVAS_STATIC_BUILD_VG_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 \ 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 static_libs/vg_common/vg_common.h
lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/static_libs/vg_common \ lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/static_libs/vg_common \
@evas_vg_loader_svg_cflags@ @evas_vg_loader_svg_cflags@
@ -1471,7 +1471,7 @@ install_vgloadersvgpkgLTLIBRARIES = install-vgloadersvgpkgLTLIBRARIES
$(install_vgloadersvgpkgLTLIBRARIES): install-libLTLIBRARIES $(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_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 static_libs/vg_common/vg_common.h
modules_evas_vg_loaders_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ modules_evas_vg_loaders_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/evas/include \ -I$(top_srcdir)/src/lib/evas/include \
@ -1494,7 +1494,7 @@ install_vgsaversvgpkgLTLIBRARIES = install-vgloadersvgpkgLTLIBRARIES
$(install_vgsaversvgpkgLTLIBRARIES): install-libLTLIBRARIES $(install_vgsaversvgpkgLTLIBRARIES): install-libLTLIBRARIES
modules_evas_vg_savers_svg_module_la_SOURCES = modules/evas/vg_savers/svg/evas_vg_save_svg.c \ 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 static_libs/vg_common/vg_common.h
modules_evas_vg_savers_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ modules_evas_vg_savers_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/evas/include \ -I$(top_srcdir)/src/lib/evas/include \

View File

@ -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; *error = EVAS_LOAD_ERROR_NONE;
} }
return vg_common_create_vg_node(node); return vg_common_svg_create_vg_node(node);
} }
static Eina_Bool static Eina_Bool

View File

@ -2384,7 +2384,7 @@ evas_vg_load_file_open_svg(const char *file, const char *key EINA_UNUSED, int *e
} }
free(loader.svg_parse); free(loader.svg_parse);
eina_file_close(f); 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 = static Evas_Vg_Load_Func evas_vg_load_svg_func =

View File

@ -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; return EVAS_LOAD_ERROR_GENERIC;
svg_node_eet = vg_common_svg_node_eet(); 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_data_write(ef, svg_node_eet, key, root, compress);
eet_close(ef); eet_close(ef);
@ -71,4 +71,4 @@ EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_SAVER, vg_saver, eet);
#ifndef EVAS_STATIC_BUILD_VG_EET #ifndef EVAS_STATIC_BUILD_VG_EET
EVAS_EINA_MODULE_DEFINE(vg_saver, eet); EVAS_EINA_MODULE_DEFINE(vg_saver, eet);
#endif #endif

View File

@ -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; 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(); buf = eina_strbuf_new();
_svg_node_printf(root, buf); _svg_node_printf(root, buf);
fprintf(f, "%s\n", eina_strbuf_string_get(buf)); fprintf(f, "%s\n", eina_strbuf_string_get(buf));

View File

@ -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 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_src = files([
'vg_common.c', 'vg_common_svg.c',
'vg_common.h', 'vg_common.h',
]) ])

View File

@ -8,6 +8,9 @@
#include "evas_common_private.h" #include "evas_common_private.h"
#include "evas_private.h" #include "evas_private.h"
/******************************************************************************************
* SVG Compatible feature implementation
******************************************************************************************/
typedef enum _Svg_Node_Type Svg_Node_Type; typedef enum _Svg_Node_Type Svg_Node_Type;
typedef enum _Svg_Length_Type Svg_Length_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_Line_Node Svg_Line_Node;
typedef struct _Svg_Custom_Command_Node Svg_Custom_Command_Node; typedef struct _Svg_Custom_Command_Node Svg_Custom_Command_Node;
typedef struct _Svg_Style_Stroke Svg_Style_Stroke; typedef struct _Svg_Style_Stroke Svg_Style_Stroke;
typedef struct _Svg_Style_Fill Svg_Style_Fill; typedef struct _Svg_Style_Fill Svg_Style_Fill;
typedef enum _Svg_Fill_Flags Svg_Fill_Flags; typedef enum _Svg_Fill_Flags Svg_Fill_Flags;
typedef enum _Svg_Stroke_Flags Svg_Stroke_Flags; typedef enum _Svg_Stroke_Flags Svg_Stroke_Flags;
typedef enum _Svg_Gradient_Type Svg_Gradient_Type; typedef enum _Svg_Gradient_Type Svg_Gradient_Type;
typedef struct _Svg_Style_Gradient Svg_Style_Gradient; typedef struct _Svg_Style_Gradient Svg_Style_Gradient;
typedef struct _Svg_Linear_Gradient Svg_Linear_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); Eet_Data_Descriptor * vg_common_svg_node_eet(void);
void vg_common_svg_node_eet_destroy(void); void vg_common_svg_node_eet_destroy(void);
Vg_File_Data * vg_common_create_vg_node(Svg_Node *node); Vg_File_Data * vg_common_svg_create_vg_node(Svg_Node *node);
Svg_Node * vg_common_create_svg_node(Vg_File_Data *node); Svg_Node *vg_common_svg_create_svg_node(Vg_File_Data *node);
void vg_common_svg_node_free(Svg_Node *node); void vg_common_svg_node_free(Svg_Node *node);
#endif //EVAS_VG_COMMON_H_ #endif //EVAS_VG_COMMON_H_

View File

@ -7,8 +7,6 @@
#include <Eet.h> #include <Eet.h>
#include <Evas.h> #include <Evas.h>
Eet_Data_Descriptor *_eet_rect_node = NULL; Eet_Data_Descriptor *_eet_rect_node = NULL;
Eet_Data_Descriptor *_eet_circle_node = NULL; Eet_Data_Descriptor *_eet_circle_node = NULL;
Eet_Data_Descriptor *_eet_ellipse_node = NULL; Eet_Data_Descriptor *_eet_ellipse_node = NULL;
@ -333,7 +331,7 @@ _eet_for_path_node(void)
return eet; return eet;
} }
struct static struct
{ {
Svg_Node_Type u; Svg_Node_Type u;
const char *name; const char *name;
@ -354,8 +352,6 @@ struct
}; };
static const char * static const char *
/* union
type_get() */
_union_type_get(const void *data, _union_type_get(const void *data,
Eina_Bool *unknow) Eina_Bool *unknow)
{ {
@ -372,7 +368,7 @@ _union_type_get(const void *data,
if (unknow) if (unknow)
*unknow = EINA_TRUE; *unknow = EINA_TRUE;
return NULL; return NULL;
} /* _union_type_get */ }
static Eina_Bool static Eina_Bool
_union_type_set(const char *type, _union_type_set(const char *type,
@ -392,7 +388,7 @@ _union_type_set(const char *type,
return EINA_TRUE; return EINA_TRUE;
} }
return EINA_FALSE; return EINA_FALSE;
} /* _union_type_set */ }
Eet_Data_Descriptor * Eet_Data_Descriptor *
vg_common_svg_node_eet(void) vg_common_svg_node_eet(void)
@ -450,7 +446,7 @@ vg_common_svg_node_eet(void)
return _eet_vg_node; return _eet_vg_node;
} }
void void
vg_common_svg_node_eet_destroy(void) vg_common_svg_node_eet_destroy(void)
{ {
FREE_DESCRIPTOR(_eet_rect_node); 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); efl_gfx_path_bounds_get(grad_obj, &grad_geom);
double cy = (grad_geom.h / 2.0) + grad_geom.y; double cy = (grad_geom.h / 2) + grad_geom.y;
double cy_scaled = (grad_geom.h / 2.0) * scale_reversed_Y; double cy_scaled = (grad_geom.h / 2) * scale_reversed_Y;
double cx = (grad_geom.w / 2.0) + grad_geom.x; double cx = grad_geom.w / 2 + grad_geom.x;
double cx_scaled = (grad_geom.w / 2.0) * scale_reversed_X; double cx_scaled = (grad_geom.w / 2) * scale_reversed_X;
/* matrix tranformation of gradient figure: /* matrix tranformation of gradient figure:
* 0. we remember size of gradient and it's center point * 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_File_Data *
vg_common_create_vg_node(Svg_Node *node) vg_common_svg_create_vg_node(Svg_Node *node)
{ {
Vg_File_Data *vg_data; Vg_File_Data *vg_data;
@ -1013,7 +1009,7 @@ vg_common_create_svg_node_helper(Efl_VG *vg, Svg_Node *parent)
} }
Svg_Node * Svg_Node *
vg_common_create_svg_node(Vg_File_Data *node) vg_common_svg_create_svg_node(Vg_File_Data *node)
{ {
Svg_Node *doc; Svg_Node *doc;