svg_parse: The percentage gradient value divide by view's size

Summary:
The default unit of gradient value is percentage.
This can be a value from 0 to 1.
If svg use the '%' symbol, we must divide by 100.
And it must be calculated the same as any other case.

Test Plan: N/A

Reviewers: Hermet, smohanty

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8590
This commit is contained in:
junsu choi 2019-04-10 17:39:36 +09:00 committed by Hermet Park
parent 0afd19ba62
commit 96e6d307b8
1 changed files with 3 additions and 8 deletions

View File

@ -144,13 +144,6 @@ _gradient_to_double(Evas_SVG_Parser *svg_parse, const char *str, SVG_Parser_Leng
double parsed_value = strtod(str, &end); double parsed_value = strtod(str, &end);
double max = 1; double max = 1;
/* unique case, if that is percentage, just return it */
if (strstr(str, "%"))
{
parsed_value = parsed_value / 100.0;
return parsed_value;
}
/** /**
* That is according to Units in here * That is according to Units in here
* *
@ -164,7 +157,9 @@ _gradient_to_double(Evas_SVG_Parser *svg_parse, const char *str, SVG_Parser_Leng
max = sqrt(pow(svg_parse->global.height, 2) + max = sqrt(pow(svg_parse->global.height, 2) +
pow(svg_parse->global.width, 2)) / sqrt(2.0); pow(svg_parse->global.width, 2)) / sqrt(2.0);
if (strstr(str, "cm")) if (strstr(str, "%"))
parsed_value = parsed_value / 100.0;
else if (strstr(str, "cm"))
parsed_value = parsed_value * 35.43307; parsed_value = parsed_value * 35.43307;
else if (strstr(str, "mm")) else if (strstr(str, "mm"))
parsed_value = parsed_value * 3.543307; parsed_value = parsed_value * 3.543307;