summaryrefslogtreecommitdiff
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
parentfac649c7f41c148ac4750c626bf93a5fd9b4ae49 (diff)
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
28 Eina_Bool result:1; 28 Eina_Bool result:1;
29}; 29};
30 30
31/* Global struct for working global cases during the parse */
32typedef struct {
33 struct {
34 int x, y, width, height;
35 } global;
36} Evas_SVG_Parsing;
37static Evas_SVG_Parsing svg_parse;
38
31char * 39char *
32_skip_space(const char *str, const char *end) 40_skip_space(const char *str, const char *end)
33{ 41{
@@ -661,9 +669,19 @@ _attr_parse_svg_node(void *data, const char *key, const char *value)
661 else if (!strcmp(key, "viewBox")) 669 else if (!strcmp(key, "viewBox"))
662 { 670 {
663 if (_parse_number(&value, &doc->vx)) 671 if (_parse_number(&value, &doc->vx))
664 if (_parse_number(&value, &doc->vy)) 672 {
665 if (_parse_number(&value, &doc->vw)) 673 if (_parse_number(&value, &doc->vy))
666 _parse_number(&value, &doc->vh); 674 {
675 if (_parse_number(&value, &doc->vw))
676 {
677 _parse_number(&value, &doc->vh);
678 svg_parse.global.height = doc->vh;
679 }
680 svg_parse.global.width = doc->vw;
681 }
682 svg_parse.global.y = doc->vy;
683 }
684 svg_parse.global.x = doc->vx;
667 } 685 }
668 else if (!strcmp(key, "preserveAspectRatio")) 686 else if (!strcmp(key, "preserveAspectRatio"))
669 { 687 {