vg_common: parse and store userSpaceOnUse (for gradient) when it is set

So it can be calculated during the draw later on
This commit is contained in:
Vitalii Vorobiov 2017-02-14 17:37:27 +02:00 committed by Jean-Philippe Andre
parent 73bfd4f04d
commit fac649c7f4
3 changed files with 16 additions and 1 deletions

View File

@ -1374,6 +1374,7 @@ _clone_gradient(Svg_Style_Gradient *from)
grad->id = _copy_id(from->id);
grad->ref = _copy_id(from->ref);
grad->spread = from->spread;
grad->user_space = from->user_space;
grad->stops = _clone_grad_stops(from->stops);
if (grad->type == SVG_LINEAR_GRADIENT)
{
@ -1659,6 +1660,10 @@ _attr_parse_radial_gradient_node(void *data, const char *key, const char *value)
{
grad->ref = _id_from_href(value);
}
else if (!strcmp(key, "gradientUnits") && !strcmp(value, "userSpaceOnUse"))
{
grad->user_space = EINA_TRUE;
}
return EINA_TRUE;
}
@ -1777,6 +1782,10 @@ _attr_parse_linear_gradient_node(void *data, const char *key, const char *value)
{
grad->ref = _id_from_href(value);
}
else if (!strcmp(key, "gradientUnits") && !strcmp(value, "userSpaceOnUse"))
{
grad->user_space = EINA_TRUE;
}
return EINA_TRUE;
}
@ -2185,4 +2194,4 @@ 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
#endif

View File

@ -554,6 +554,11 @@ _apply_gradient_property(Svg_Style_Gradient *g)
int stop_count = 0, i = 0;
Eina_List *l;
/*
if (!g->user_space)
//get bounding box
*/
if (g->type == SVG_LINEAR_GRADIENT)
{
grad_obj = evas_vg_gradient_linear_add(NULL);

View File

@ -182,6 +182,7 @@ struct _Svg_Style_Gradient
Eina_Stringshare *id;
Eina_Stringshare *ref;
Efl_Gfx_Gradient_Spread spread;
Eina_Bool user_space;
Eina_List *stops; // Efl_Gfx_Gradient_Stop
Svg_Radial_Gradient *radial;
Svg_Linear_Gradient *linear;