aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitalii Vorobiov <vi.vorobiov@samsung.com>2017-02-14 17:51:13 +0200
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 11:54:09 +0900
commit1354c1c8ab53ab10e4da195aa1ac157c65ba6bf8 (patch)
treece3bfdcdbf0c9f7736d0d55aa1d4b25ac040eaa6
parentvg_common: parse and store userSpaceOnUse (for gradient) when it is set (diff)
downloadefl-1354c1c8ab53ab10e4da195aa1ac157c65ba6bf8.tar.gz
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)
-rw-r--r--src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c24
1 files changed, 21 insertions, 3 deletions
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 5f7b632144..531cb05b9c 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
@@ -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"))
{