mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 11:36:25 +00:00
loader/svg: Fix zero check of arc's rx and ry
Please refer to the specifications. https://www.w3.org/TR/SVG/paths.html#ArcOutOfRangeParameters If either rx or ry is 0, then this arc is treated as a straight line segment(a "lineto") joining the endpoints.
This commit is contained in:
parent
fc5ca21dea
commit
07b11e0528
1 changed files with 2 additions and 4 deletions
|
@ -51,7 +51,6 @@
|
|||
#define _USE_MATH_DEFINES //Math Constants are not defined in Standard C/C++.
|
||||
|
||||
#include <cstring>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include "tvgMath.h"
|
||||
#include "tvgShape.h"
|
||||
|
@ -472,13 +471,12 @@ static bool _processCommand(Array<PathCommand>* cmds, Array<Point>* pts, char cm
|
|||
}
|
||||
case 'a':
|
||||
case 'A': {
|
||||
if (arr[0] < FLT_EPSILON || arr[1] < FLT_EPSILON) {
|
||||
if (mathZero(arr[0]) || mathZero(arr[1])) {
|
||||
Point p = {arr[5], arr[6]};
|
||||
cmds->push(PathCommand::LineTo);
|
||||
pts->push(p);
|
||||
*cur = {arr[5], arr[6]};
|
||||
}
|
||||
else if (!mathEqual(cur->x, arr[5]) || !mathEqual(cur->y, arr[6])) {
|
||||
} else if (!mathEqual(cur->x, arr[5]) || !mathEqual(cur->y, arr[6])) {
|
||||
_pathAppendArcTo(cmds, pts, cur, curCtl, arr[5], arr[6], fabsf(arr[0]), fabsf(arr[1]), arr[2], arr[3], arr[4]);
|
||||
*cur = *curCtl = {arr[5], arr[6]};
|
||||
*isQuadratic = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue