mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 09:30:37 +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;
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user