mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
svg_loader: correct polygon's points loading
Only an even number of correctly read points defining a polygon should be loaded and passed on for rendering. Any remaining points should be ignored.
This commit is contained in:
parent
2cb89c71a1
commit
8d81ad360f
1 changed files with 5 additions and 2 deletions
|
@ -1724,8 +1724,11 @@ static SvgNode* _createEllipseNode(SvgLoaderData* loader, SvgNode* parent, const
|
||||||
|
|
||||||
static bool _attrParsePolygonPoints(const char* str, SvgPolygonNode* polygon)
|
static bool _attrParsePolygonPoints(const char* str, SvgPolygonNode* polygon)
|
||||||
{
|
{
|
||||||
float num;
|
float num_x, num_y;
|
||||||
while (_parseNumber(&str, nullptr, &num)) polygon->pts.push(num);
|
while (_parseNumber(&str, nullptr, &num_x) && _parseNumber(&str, nullptr, &num_y)) {
|
||||||
|
polygon->pts.push(num_x);
|
||||||
|
polygon->pts.push(num_y);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue