Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
bb69f2be
Commit
bb69f2be
authored
Mar 14, 2017
by
Tebjan Halm
Committed by
GitHub
Mar 14, 2017
Browse files
Merge pull request #297 from LightningDragon/master
Found better solution to SvgClosePathSegment tested with Tiger.
parents
35d0e857
6a20095e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Paths/SvgClosePathSegment.cs
View file @
bb69f2be
...
@@ -8,24 +8,22 @@ namespace Svg.Pathing
...
@@ -8,24 +8,22 @@ namespace Svg.Pathing
{
{
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
{
{
if
(
graphicsPath
.
PointCount
==
0
)
var
pathData
=
graphicsPath
.
PathData
;
if
(
pathData
.
Points
.
Length
>
0
)
{
{
return
;
// Important for custom line caps. Force the path the close with an explicit line, not just an implicit close of the figure.
}
// Important for custom line caps. Force the path the close with an explicit line, not just an implicit close of the figure.
if
(!
pathData
.
Points
[
0
].
Equals
(
pathData
.
Points
[
pathData
.
Points
.
Length
-
1
]))
var
pathPoints
=
graphicsPath
.
PathPoints
;
{
int
i
=
pathData
.
Points
.
Length
-
1
;
while
(
i
>=
0
&&
pathData
.
Types
[
i
]
>
0
)
i
--;
if
(
i
<
0
)
i
=
0
;
graphicsPath
.
AddLine
(
pathData
.
Points
[
pathData
.
Points
.
Length
-
1
],
pathData
.
Points
[
i
]);
}
if
(!
pathPoints
[
0
].
Equals
(
pathPoints
[
pathPoints
.
Length
-
1
]))
graphicsPath
.
CloseFigure
();
{
var
pathTypes
=
graphicsPath
.
PathTypes
;
int
i
=
pathPoints
.
Length
-
1
;
while
(
i
>=
0
&&
pathTypes
[
i
]
>
0
)
i
--;
if
(
i
<
0
)
i
=
0
;
graphicsPath
.
AddLine
(
pathPoints
[
pathPoints
.
Length
-
1
],
pathPoints
[
i
]);
}
}
graphicsPath
.
CloseFigure
();
}
}
public
override
string
ToString
()
public
override
string
ToString
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment