mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
loader/svg: Check current graphics node that not closed
If any of the graphics nodes are not closed, the graphics nodes between them are ignored. related issue: https://github.com/thorvg/thorvg/issues/2210
This commit is contained in:
parent
a1ffa039bb
commit
0d20eb71eb
2 changed files with 14 additions and 0 deletions
|
@ -3198,6 +3198,14 @@ static void _svgLoaderParserXmlClose(SvgLoaderData* loader, const char* content)
|
|||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(graphicsTags) / sizeof(graphicsTags[0]); i++) {
|
||||
if (!strncmp(content, graphicsTags[i].tag, graphicsTags[i].sz - 1)) {
|
||||
loader->currentGraphicsNode = nullptr;
|
||||
loader->stack.pop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
loader->level--;
|
||||
}
|
||||
|
||||
|
@ -3264,6 +3272,11 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
|
|||
if (loader->stack.count > 0) parent = loader->stack.last();
|
||||
else parent = loader->doc;
|
||||
node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes);
|
||||
if (node && !empty) {
|
||||
auto defs = _createDefsNode(loader, nullptr, nullptr, 0, nullptr);
|
||||
loader->stack.push(defs);
|
||||
loader->currentGraphicsNode = node;
|
||||
}
|
||||
} else if ((gradientMethod = _findGradientFactory(tagName))) {
|
||||
SvgStyleGradient* gradient;
|
||||
gradient = gradientMethod(loader, attrs, attrsLength);
|
||||
|
|
|
@ -560,6 +560,7 @@ struct SvgLoaderData
|
|||
int level = 0;
|
||||
bool result = false;
|
||||
bool style = false;
|
||||
SvgNode* currentGraphicsNode = nullptr;
|
||||
};
|
||||
|
||||
struct Box
|
||||
|
|
Loading…
Add table
Reference in a new issue