mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 14:41:50 +00:00
Revert "loader/svg: Skip to invalid polygon"
This reverts commit 75e587a9a9
.
If incorrect data for the points in a polygon is provided,
the element should still be rendered, but only up to the point
where the error occurs—using an even number of the points that
have been successfully loaded.
This commit is contained in:
parent
c3a6523294
commit
2cb89c71a1
2 changed files with 1 additions and 6 deletions
|
@ -1726,10 +1726,6 @@ static bool _attrParsePolygonPoints(const char* str, SvgPolygonNode* polygon)
|
||||||
{
|
{
|
||||||
float num;
|
float num;
|
||||||
while (_parseNumber(&str, nullptr, &num)) polygon->pts.push(num);
|
while (_parseNumber(&str, nullptr, &num)) polygon->pts.push(num);
|
||||||
if (polygon->pts.count % 2 != 0) {
|
|
||||||
polygon->pts.clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1772,7 +1768,7 @@ static SvgNode* _createPolygonNode(SvgLoaderData* loader, SvgNode* parent, const
|
||||||
|
|
||||||
if (!loader->svgParse->node) return nullptr;
|
if (!loader->svgParse->node) return nullptr;
|
||||||
|
|
||||||
if (!func(buf, bufLength, _attrParsePolygonNode, loader)) return nullptr;
|
func(buf, bufLength, _attrParsePolygonNode, loader);
|
||||||
return loader->svgParse->node;
|
return loader->svgParse->node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,6 @@ bool simpleXmlParseAttributes(const char* buf, unsigned bufLength, simpleXMLAttr
|
||||||
if (!func((void*)data, tmpBuf, tval)) {
|
if (!func((void*)data, tmpBuf, tval)) {
|
||||||
if (!_isIgnoreUnsupportedLogAttributes(tmpBuf, tval)) {
|
if (!_isIgnoreUnsupportedLogAttributes(tmpBuf, tval)) {
|
||||||
TVGLOG("SVG", "Unsupported attributes used [Elements type: %s][Id : %s][Attribute: %s][Value: %s]", simpleXmlNodeTypeToString(((SvgLoaderData*)data)->svgParse->node->type), ((SvgLoaderData*)data)->svgParse->node->id ? ((SvgLoaderData*)data)->svgParse->node->id : "NO_ID", tmpBuf, tval ? tval : "NONE");
|
TVGLOG("SVG", "Unsupported attributes used [Elements type: %s][Id : %s][Attribute: %s][Value: %s]", simpleXmlNodeTypeToString(((SvgLoaderData*)data)->svgParse->node->type), ((SvgLoaderData*)data)->svgParse->node->id ? ((SvgLoaderData*)data)->svgParse->node->id : "NO_ID", tmpBuf, tval ? tval : "NONE");
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue