fpvectorial: Fix svgreader incorrectly terminating subpolygons in multiple polygons

git-svn-id: trunk@52804 -
This commit is contained in:
wp 2016-08-14 09:12:51 +00:00
parent 08e9be93a9
commit e9cab2159d

View File

@ -2174,15 +2174,25 @@ var
lToken5Before, lToken7Before: TSVGTokenType; lToken5Before, lToken7Before: TSVGTokenType;
lCorrectPreviousToken: Boolean; lCorrectPreviousToken: Boolean;
lPrevRelative, lCurRelative: Boolean; lPrevRelative, lCurRelative: Boolean;
isFirstMove: Boolean;
startX, startY: Double;
begin begin
isFirstMove := true;
lCurTokenType := ACurTokenType; lCurTokenType := ACurTokenType;
// -------------- // --------------
// Moves // Moves
// -------------- // --------------
if lCurTokenType in [sttMoveTo, sttRelativeMoveTo] then if lCurTokenType in [sttMoveTo, sttRelativeMoveTo] then
begin begin
X := FSVGPathTokenizer.Tokens.Items[i+1].Value; // The point at which the polygon starts. Since there may be several
Y := FSVGPathTokenizer.Tokens.Items[i+2].Value; // subpolygons we must store it to close the subpolygon correctly later.
startX := FSVGPathTokenizer.Tokens.Items[i+1].Value;
startY := FSVGPathTokenizer.Tokens.Items[i+2].Value;
if isFirstMove then begin
X := startX;
Y := startY;
isFirstMove := false;
end;
// take care of relative or absolute // take care of relative or absolute
// Idiotism in SVG: If the path starts with a relative move to, // Idiotism in SVG: If the path starts with a relative move to,
@ -2208,12 +2218,9 @@ begin
// -------------- // --------------
else if lCurTokenType = sttClosePath then else if lCurTokenType = sttClosePath then
begin begin
// Get the first point // Repeat the first point of the subpolygon
AData.GetTmpPathStartPos(X, Y); CurX := startX;
CurY := startY;
// And repeat it
CurX := X;
CurY := Y;
AData.AddLineToPath(CurX, CurY); AData.AddLineToPath(CurX, CurY);
Inc(i, 1); Inc(i, 1);