summaryrefslogtreecommitdiff
path: root/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2020-09-10 14:59:29 +0900
committerHermet Park <chuneon.park@samsung.com>2020-09-10 14:59:29 +0900
commitd9c3b3f1b9fa87451aa39da1654a32d3023d9e75 (patch)
treef2024e4aea5055345c14547821291b4c036325be /src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
parent7b7f69e09fb198a881a931bd79ac61b5260b1bb0 (diff)
vg_load_svg: Supports case when only rx or ry is declared
Summary: In relation to the declaration of rx and ry attribute of rect, the following three cases occur. rx="10" (or ry="10" rx="10" ry = "0" (or rx="0" ry = "10") rx="10" ry = "10" To cover these case, we check the rx and ry declarations. Test Plan: N/A Reviewers: Hermet, smohanty Subscribers: kimcinoo, herb, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12137
Diffstat (limited to '')
-rw-r--r--src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c15
1 files changed, 13 insertions, 2 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 6498f1ab10..d4ea28659c 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
@@ -1381,6 +1381,13 @@ _attr_parse_rect_node(void *data, const char *key, const char *value)
1381 if (rect_tags[i].sz - 1 == sz && !strncmp(rect_tags[i].tag, key, sz)) 1381 if (rect_tags[i].sz - 1 == sz && !strncmp(rect_tags[i].tag, key, sz))
1382 { 1382 {
1383 *((double*) (array + rect_tags[i].offset)) = _to_double(loader->svg_parse, value, rect_tags[i].type); 1383 *((double*) (array + rect_tags[i].offset)) = _to_double(loader->svg_parse, value, rect_tags[i].type);
1384
1385 //Case if only rx or ry is declared
1386 if (!strncmp(rect_tags[i].tag, "rx", sz)) rect->has_rx = EINA_TRUE;
1387 if (!strncmp(rect_tags[i].tag, "ry", sz)) rect->has_ry = EINA_TRUE;
1388
1389 if (!EINA_DBL_EQ(rect->rx, 0) && EINA_DBL_EQ(rect->ry, 0) && rect->has_rx && !rect->has_ry) rect->ry = rect->rx;
1390 if (!EINA_DBL_EQ(rect->ry, 0) && EINA_DBL_EQ(rect->rx, 0) && !rect->has_rx && rect->has_ry) rect->rx = rect->ry;
1384 return EINA_TRUE; 1391 return EINA_TRUE;
1385 } 1392 }
1386 1393
@@ -1397,8 +1404,6 @@ _attr_parse_rect_node(void *data, const char *key, const char *value)
1397 _parse_style_attr(loader, key, value); 1404 _parse_style_attr(loader, key, value);
1398 } 1405 }
1399 1406
1400 if (!EINA_DBL_EQ(rect->rx, 0) && EINA_DBL_EQ(rect->ry, 0)) rect->ry = rect->rx;
1401 if (!EINA_DBL_EQ(rect->ry, 0) && EINA_DBL_EQ(rect->rx, 0)) rect->rx = rect->ry;
1402 1407
1403 return EINA_TRUE; 1408 return EINA_TRUE;
1404} 1409}
@@ -1408,6 +1413,10 @@ _create_rect_node(Evas_SVG_Loader *loader, Svg_Node *parent, const char *buf, un
1408{ 1413{
1409 loader->svg_parse->node = _create_node(parent, SVG_NODE_RECT); 1414 loader->svg_parse->node = _create_node(parent, SVG_NODE_RECT);
1410 1415
1416 if (loader->svg_parse->node) {
1417 loader->svg_parse->node->node.rect.has_rx = loader->svg_parse->node->node.rect.has_ry = EINA_FALSE;
1418 }
1419
1411 eina_simple_xml_attributes_parse(buf, buflen, 1420 eina_simple_xml_attributes_parse(buf, buflen,
1412 _attr_parse_rect_node, loader); 1421 _attr_parse_rect_node, loader);
1413 return loader->svg_parse->node; 1422 return loader->svg_parse->node;
@@ -1601,6 +1610,8 @@ _copy_attribute(Svg_Node *to, Svg_Node *from)
1601 to->node.rect.h = from->node.rect.h; 1610 to->node.rect.h = from->node.rect.h;
1602 to->node.rect.rx = from->node.rect.rx; 1611 to->node.rect.rx = from->node.rect.rx;
1603 to->node.rect.ry = from->node.rect.ry; 1612 to->node.rect.ry = from->node.rect.ry;
1613 to->node.rect.has_rx = from->node.rect.has_rx;
1614 to->node.rect.has_ry = from->node.rect.has_ry;
1604 break; 1615 break;
1605 case SVG_NODE_LINE: 1616 case SVG_NODE_LINE:
1606 to->node.line.x1 = from->node.line.x1; 1617 to->node.line.x1 = from->node.line.x1;