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
df86976f
Commit
df86976f
authored
Jun 27, 2013
by
Tebjan Halm
Browse files
big performance improvement (over 50%) for writing svg strings
parent
84b71ceb
Changes
2
Show whitespace changes
Inline
Side-by-side
Source/Svg.csproj
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"
/>
...
...
Source/SvgElement.cs
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
)))
{
...
...
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