forked from enlightenment/efl
svg_loader: Fixed color attribute parser
Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4049
This commit is contained in:
parent
39452ff848
commit
67e400a3c9
|
@ -260,14 +260,15 @@ _to_color(const char *str, int *r, int *g, int *b, char** ref)
|
||||||
|
|
||||||
if (len == 4 && str[0] == '#')
|
if (len == 4 && str[0] == '#')
|
||||||
{
|
{
|
||||||
|
// case for "#456" should be interprete as "#445566"
|
||||||
if (isxdigit(str[1]) &&
|
if (isxdigit(str[1]) &&
|
||||||
isxdigit(str[2]) &&
|
isxdigit(str[2]) &&
|
||||||
isxdigit(str[3]))
|
isxdigit(str[3]))
|
||||||
{
|
{
|
||||||
char tmp[2] = { '\0', '\0' };
|
char tmp[3] = { '\0', '\0', '\0' };
|
||||||
tmp[0] = str[1]; *r = strtol(tmp, NULL, 16);
|
tmp[0] = str[1]; tmp[1] = str[1]; *r = strtol(tmp, NULL, 16);
|
||||||
tmp[0] = str[2]; *g = strtol(tmp, NULL, 16);
|
tmp[0] = str[2]; tmp[1] = str[2]; *g = strtol(tmp, NULL, 16);
|
||||||
tmp[0] = str[3]; *b = strtol(tmp, NULL, 16);
|
tmp[0] = str[3]; tmp[1] = str[3]; *b = strtol(tmp, NULL, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (len == 7 && str[0] == '#')
|
else if (len == 7 && str[0] == '#')
|
||||||
|
|
Loading…
Reference in New Issue