Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
df86976f
Commit
df86976f
authored
11 years ago
by
Tebjan Halm
Browse files
Options
Download
Email Patches
Plain Diff
big performance improvement (over 50%) for writing svg strings
parent
84b71ceb
master
netstandard2
nuget2.4.2
nuget2.4.1
nuget2.4
nuget2.3
nuget2.2.2
nuget2.2.1
nuget1.7
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/Svg.csproj
+0
-6
Source/Svg.csproj
Source/SvgElement.cs
+16
-6
Source/SvgElement.cs
with
16 additions
and
12 deletions
+16
-12
Source/Svg.csproj
+
0
-
6
View file @
df86976f
...
...
@@ -70,13 +70,7 @@
<DocumentationFile>
bin\Release\Svg.XML
</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Microsoft.JScript"
/>
<Reference
Include=
"Microsoft.Vsa"
/>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Drawing"
/>
<Reference
Include=
"System.Web"
/>
<Reference
Include=
"System.Xml"
/>
...
...
This diff is collapsed.
Click to expand it.
Source/SvgElement.cs
+
16
-
6
View file @
df86976f
...
...
@@ -15,6 +15,15 @@ namespace Svg
/// </summary>
public
abstract
class
SvgElement
:
ISvgElement
,
ISvgTransformable
,
ICloneable
{
//optimization
protected
class
AttributeTuple
{
public
PropertyDescriptor
Property
;
public
SvgAttributeAttribute
Attribute
;
}
protected
IEnumerable
<
AttributeTuple
>
_svgAttributes
;
internal
SvgElement
_parent
;
private
string
_elementName
;
private
SvgAttributeCollection
_attributes
;
...
...
@@ -283,6 +292,12 @@ namespace Svg
this
.
_eventHandlers
=
new
EventHandlerList
();
this
.
_elementName
=
string
.
Empty
;
this
.
_customAttributes
=
new
Dictionary
<
string
,
string
>();
//fill svg attribute description
_svgAttributes
=
from
PropertyDescriptor
a
in
TypeDescriptor
.
GetProperties
(
this
)
let
attribute
=
a
.
Attributes
[
typeof
(
SvgAttributeAttribute
)]
as
SvgAttributeAttribute
where
attribute
!=
null
select
new
AttributeTuple
{
Property
=
a
,
Attribute
=
attribute
};
}
...
...
@@ -336,12 +351,7 @@ namespace Svg
protected
virtual
void
WriteAttributes
(
XmlTextWriter
writer
)
{
var
attributes
=
from
PropertyDescriptor
a
in
TypeDescriptor
.
GetProperties
(
this
)
let
attribute
=
a
.
Attributes
[
typeof
(
SvgAttributeAttribute
)]
as
SvgAttributeAttribute
where
attribute
!=
null
select
new
{
Property
=
a
,
Attribute
=
attribute
};
foreach
(
var
attr
in
attributes
)
foreach
(
var
attr
in
_svgAttributes
)
{
if
(
attr
.
Property
.
Converter
.
CanConvertTo
(
typeof
(
string
)))
{
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help