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
f1a927c0
"vscode:/vscode.git/clone" did not exist on "f20108c812d22889d25412c195d0dd8fc6854174"
Commit
f1a927c0
authored
Mar 01, 2017
by
MatthewDiamond
Browse files
Added array caching to AddToPath for a significant performance increase.
parent
df31b65d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Paths/SvgClosePathSegment.cs
View file @
f1a927c0
...
@@ -9,13 +9,17 @@ namespace Svg.Pathing
...
@@ -9,13 +9,17 @@ namespace Svg.Pathing
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
{
{
// 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
(
graphicsPath
.
PointCount
>
0
&&
!
graphicsPath
.
PathPoints
[
0
].
Equals
(
graphicsPath
.
PathPoints
[
graphicsPath
.
PathPoints
.
Length
-
1
]))
var
pathPoints
=
graphicsPath
.
PathPoints
;
if
(
pathPoints
.
Length
>
0
&&
!
pathPoints
[
0
].
Equals
(
pathPoints
[
pathPoints
.
Length
-
1
]))
{
{
int
i
=
graphicsPath
.
PathTypes
.
Length
-
1
;
var
pathTypes
=
graphicsPath
.
PathTypes
;
while
(
i
>=
0
&&
graphicsPath
.
PathTypes
[
i
]
>
0
)
i
--;
int
i
=
pathPoints
.
Length
-
1
;
while
(
i
>=
0
&&
pathTypes
[
i
]
>
0
)
i
--;
if
(
i
<
0
)
i
=
0
;
if
(
i
<
0
)
i
=
0
;
graphicsPath
.
AddLine
(
graphicsPath
.
PathPoints
[
graphicsPath
.
P
athPoints
.
Length
-
1
],
graphicsPath
.
P
athPoints
[
i
]);
graphicsPath
.
AddLine
(
pathPoints
[
p
athPoints
.
Length
-
1
],
p
athPoints
[
i
]);
}
}
graphicsPath
.
CloseFigure
();
graphicsPath
.
CloseFigure
();
}
}
...
...
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