svg_parse: save global size variable to use when gradient size recalc

For example while userSpaceOnUse it uses not figure's x,y,w,h
but entire canvas, so we need to save it publically and recalc while
parsing (or after)
This commit is contained in:
Vitalii Vorobiov 2017-02-14 17:51:13 +02:00 committed by Jean-Philippe Andre
parent fac649c7f4
commit 1354c1c8ab
1 changed files with 21 additions and 3 deletions

View File

@ -28,6 +28,14 @@ struct _Evas_SVG_Loader
Eina_Bool result:1;
};
/* Global struct for working global cases during the parse */
typedef struct {
struct {
int x, y, width, height;
} global;
} Evas_SVG_Parsing;
static Evas_SVG_Parsing svg_parse;
char *
_skip_space(const char *str, const char *end)
{
@ -661,9 +669,19 @@ _attr_parse_svg_node(void *data, const char *key, const char *value)
else if (!strcmp(key, "viewBox"))
{
if (_parse_number(&value, &doc->vx))
if (_parse_number(&value, &doc->vy))
if (_parse_number(&value, &doc->vw))
_parse_number(&value, &doc->vh);
{
if (_parse_number(&value, &doc->vy))
{
if (_parse_number(&value, &doc->vw))
{
_parse_number(&value, &doc->vh);
svg_parse.global.height = doc->vh;
}
svg_parse.global.width = doc->vw;
}
svg_parse.global.y = doc->vy;
}
svg_parse.global.x = doc->vx;
}
else if (!strcmp(key, "preserveAspectRatio"))
{