mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-12 07:32:20 +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
c5266725d4
commit
4316dd2620
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)
|
||||
{
|
||||
float num;
|
||||
while (_parseNumber(&str, nullptr, &num)) polygon->pts.push(num);
|
||||
float num_x, num_y;
|
||||
while (_parseNumber(&str, nullptr, &num_x) && _parseNumber(&str, nullptr, &num_y)) {
|
||||
polygon->pts.push(num_x);
|
||||
polygon->pts.push(num_y);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue