mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 16:38:02 +02:00
fpvectorial: Fix svgreader incorrectly terminating subpolygons in multiple polygons
git-svn-id: trunk@52804 -
This commit is contained in:
parent
08e9be93a9
commit
e9cab2159d
@ -2174,15 +2174,25 @@ var
|
||||
lToken5Before, lToken7Before: TSVGTokenType;
|
||||
lCorrectPreviousToken: Boolean;
|
||||
lPrevRelative, lCurRelative: Boolean;
|
||||
isFirstMove: Boolean;
|
||||
startX, startY: Double;
|
||||
begin
|
||||
isFirstMove := true;
|
||||
lCurTokenType := ACurTokenType;
|
||||
// --------------
|
||||
// Moves
|
||||
// --------------
|
||||
if lCurTokenType in [sttMoveTo, sttRelativeMoveTo] then
|
||||
begin
|
||||
X := FSVGPathTokenizer.Tokens.Items[i+1].Value;
|
||||
Y := FSVGPathTokenizer.Tokens.Items[i+2].Value;
|
||||
// The point at which the polygon starts. Since there may be several
|
||||
// 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
|
||||
// Idiotism in SVG: If the path starts with a relative move to,
|
||||
@ -2208,12 +2218,9 @@ begin
|
||||
// --------------
|
||||
else if lCurTokenType = sttClosePath then
|
||||
begin
|
||||
// Get the first point
|
||||
AData.GetTmpPathStartPos(X, Y);
|
||||
|
||||
// And repeat it
|
||||
CurX := X;
|
||||
CurY := Y;
|
||||
// Repeat the first point of the subpolygon
|
||||
CurX := startX;
|
||||
CurY := startY;
|
||||
AData.AddLineToPath(CurX, CurY);
|
||||
|
||||
Inc(i, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user