From 53fa042a7f0a260eea017fff678c12c1d59cc0d4 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 30 Oct 2022 10:53:52 +0100 Subject: [PATCH] Squashed 'external/lunasvg/' changes from be5d0977b..c272a2188 c272a2188 Fix smooth curve parsing #80 #114 git-subtree-dir: external/lunasvg git-subtree-split: c272a2188bc38b0e46130f7a289cab57e50238cb --- source/parser.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/source/parser.cpp b/source/parser.cpp index 5e4dee02b..34325b194 100644 --- a/source/parser.cpp +++ b/source/parser.cpp @@ -176,7 +176,6 @@ Path Parser::parsePath(const std::string& string) double c[6]; bool f[2]; - int lastCommand = 0; Point startPoint; Point currentPoint; Point controlPoint; @@ -259,8 +258,6 @@ Path Parser::parsePath(const std::string& string) break; case 'T': case 't': - if(lastCommand != 'Q' && lastCommand != 'q' && lastCommand != 'T' && lastCommand != 't') - controlPoint = currentPoint; c[0] = 2 * currentPoint.x - controlPoint.x; c[1] = 2 * currentPoint.y - controlPoint.y; if(!parseNumberList(ptr, end, c + 2, 2)) @@ -280,8 +277,6 @@ Path Parser::parsePath(const std::string& string) break; case 'S': case 's': - if(lastCommand != 'C' && lastCommand != 'c' && lastCommand != 'S' && lastCommand != 's') - controlPoint = currentPoint; c[0] = 2 * currentPoint.x - controlPoint.x; c[1] = 2 * currentPoint.y - controlPoint.y; if(!parseNumberList(ptr, end, c + 2, 4)) @@ -311,6 +306,7 @@ Path Parser::parsePath(const std::string& string) path.lineTo(c[0], currentPoint.y); currentPoint.x = controlPoint.x = c[0]; + controlPoint.y = currentPoint.y; break; case 'V': case 'v': @@ -321,6 +317,7 @@ Path Parser::parsePath(const std::string& string) c[1] += currentPoint.y; path.lineTo(currentPoint.x, c[1]); + controlPoint.x = currentPoint.x; currentPoint.y = controlPoint.y = c[1]; break; case 'A': @@ -356,10 +353,7 @@ Path Parser::parsePath(const std::string& string) break; if(IS_ALPHA(*ptr)) - { - lastCommand = command; command = *ptr++; - } } return path;