Merge commit '53fa042a7f0a260eea017fff678c12c1d59cc0d4'

This commit is contained in:
Leon Styhre 2022-10-30 10:53:52 +01:00
commit da0226624b

View file

@ -176,7 +176,6 @@ Path Parser::parsePath(const std::string& string)
double c[6]; double c[6];
bool f[2]; bool f[2];
int lastCommand = 0;
Point startPoint; Point startPoint;
Point currentPoint; Point currentPoint;
Point controlPoint; Point controlPoint;
@ -259,8 +258,6 @@ Path Parser::parsePath(const std::string& string)
break; break;
case 'T': case 'T':
case 't': case 't':
if(lastCommand != 'Q' && lastCommand != 'q' && lastCommand != 'T' && lastCommand != 't')
controlPoint = currentPoint;
c[0] = 2 * currentPoint.x - controlPoint.x; c[0] = 2 * currentPoint.x - controlPoint.x;
c[1] = 2 * currentPoint.y - controlPoint.y; c[1] = 2 * currentPoint.y - controlPoint.y;
if(!parseNumberList(ptr, end, c + 2, 2)) if(!parseNumberList(ptr, end, c + 2, 2))
@ -280,8 +277,6 @@ Path Parser::parsePath(const std::string& string)
break; break;
case 'S': case 'S':
case 's': case 's':
if(lastCommand != 'C' && lastCommand != 'c' && lastCommand != 'S' && lastCommand != 's')
controlPoint = currentPoint;
c[0] = 2 * currentPoint.x - controlPoint.x; c[0] = 2 * currentPoint.x - controlPoint.x;
c[1] = 2 * currentPoint.y - controlPoint.y; c[1] = 2 * currentPoint.y - controlPoint.y;
if(!parseNumberList(ptr, end, c + 2, 4)) if(!parseNumberList(ptr, end, c + 2, 4))
@ -311,6 +306,7 @@ Path Parser::parsePath(const std::string& string)
path.lineTo(c[0], currentPoint.y); path.lineTo(c[0], currentPoint.y);
currentPoint.x = controlPoint.x = c[0]; currentPoint.x = controlPoint.x = c[0];
controlPoint.y = currentPoint.y;
break; break;
case 'V': case 'V':
case 'v': case 'v':
@ -321,6 +317,7 @@ Path Parser::parsePath(const std::string& string)
c[1] += currentPoint.y; c[1] += currentPoint.y;
path.lineTo(currentPoint.x, c[1]); path.lineTo(currentPoint.x, c[1]);
controlPoint.x = currentPoint.x;
currentPoint.y = controlPoint.y = c[1]; currentPoint.y = controlPoint.y = c[1];
break; break;
case 'A': case 'A':
@ -356,10 +353,7 @@ Path Parser::parsePath(const std::string& string)
break; break;
if(IS_ALPHA(*ptr)) if(IS_ALPHA(*ptr))
{
lastCommand = command;
command = *ptr++; command = *ptr++;
}
} }
return path; return path;