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
26f61673
Commit
26f61673
authored
Aug 24, 2009
by
ddpruitt
Browse files
Commented out the Trace.TraceInformation() statements for performance.
Removed some compiler warnings.
parent
8f933da4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Basic Shapes/SvgVisualElement.cs
View file @
26f61673
...
...
@@ -136,18 +136,15 @@ namespace Svg
if
(
this
.
Stroke
!=
null
)
{
float
strokeWidth
=
this
.
StrokeWidth
.
ToDeviceValue
(
this
);
using
(
Pen
pen
=
new
Pen
(
this
.
Stroke
.
GetBrush
(
this
,
this
.
StrokeOpacity
),
strokeWidth
))
using
(
var
pen
=
new
Pen
(
this
.
Stroke
.
GetBrush
(
this
,
this
.
StrokeOpacity
),
strokeWidth
))
{
if
(
pen
!=
null
)
if
(
this
.
StrokeDashArray
!=
null
&&
this
.
StrokeDashArray
.
Count
>
0
)
{
if
(
this
.
StrokeDashArray
!=
null
)
{
/* divide by stroke width - GDI behaviour that I don't quite understand yet.*/
pen
.
DashPattern
=
this
.
StrokeDashArray
.
ConvertAll
(
u
=>
u
.
Value
/
((
strokeWidth
<=
0
)
?
1
:
strokeWidth
)).
ToArray
();
}
renderer
.
DrawPath
(
pen
,
this
.
Path
);
/* divide by stroke width - GDI behaviour that I don't quite understand yet.*/
pen
.
DashPattern
=
this
.
StrokeDashArray
.
ConvertAll
(
u
=>
u
.
Value
/((
strokeWidth
<=
0
)
?
1
:
strokeWidth
)).
ToArray
();
}
renderer
.
DrawPath
(
pen
,
this
.
Path
);
}
}
}
...
...
DataTypes/SvgPoint.cs
View file @
26f61673
...
...
@@ -35,16 +35,19 @@ namespace Svg
public
override
bool
Equals
(
object
obj
)
{
if
(
obj
==
null
)
return
false
;
if
(
obj
==
null
)
return
false
;
if
(!(
obj
.
GetType
()
==
typeof
(
SvgPoint
)))
return
false
;
if
(!(
obj
.
GetType
()
==
typeof
(
SvgPoint
)))
return
false
;
SvgPoint
point
=
(
SvgPoint
)
obj
;
var
point
=
(
SvgPoint
)
obj
;
return
(
point
.
X
.
Equals
(
this
.
X
)
&&
point
.
Y
.
Equals
(
this
.
Y
));
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
();
}
public
SvgPoint
(
string
x
,
string
y
)
{
TypeConverter
converter
=
TypeDescriptor
.
GetConverter
(
typeof
(
SvgUnit
));
...
...
DataTypes/SvgUnit.cs
View file @
26f61673
...
...
@@ -160,20 +160,18 @@ namespace Svg
/// </returns>
public
override
bool
Equals
(
object
obj
)
{
if
(
obj
==
null
)
{
return
false
;
}
if
(!(
obj
.
GetType
()
==
typeof
(
SvgUnit
)))
{
return
false
;
}
if
(
obj
==
null
)
return
false
;
if
(!(
obj
.
GetType
()
==
typeof
(
SvgUnit
)))
return
false
;
SvgUnit
unit
=
(
SvgUnit
)
obj
;
var
unit
=
(
SvgUnit
)
obj
;
return
(
unit
.
Value
==
this
.
Value
&&
unit
.
Type
==
this
.
Type
);
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
();
}
/// <summary>
/// Returns the fully qualified type name of this instance.
/// </summary>
...
...
Filter Effects/feMerge/SvgMerge.cs
View file @
26f61673
...
...
@@ -10,11 +10,11 @@ namespace Svg.FilterEffects
{
public
class
SvgMerge
:
SvgFilterPrimitive
{
p
rivate
StringCollection
_m
ergeResults
;
p
ublic
StringCollection
M
ergeResults
{
get
;
private
set
;
}
public
S
tringCollection
MergeResults
public
S
vgMerge
()
{
get
{
return
this
.
_mergeResults
;
}
MergeResults
=
new
StringCollection
();
}
public
override
Bitmap
Process
()
...
...
Properties/AssemblyInfo.cs
View file @
26f61673
...
...
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"0.5.2.
0
"
)]
[
assembly
:
AssemblyVersion
(
"0.5.2.
*
"
)]
[
assembly
:
AssemblyFileVersion
(
"0.5.2.0"
)]
SvgDocument.cs
View file @
26f61673
...
...
@@ -163,7 +163,7 @@ namespace Svg
throw
new
ArgumentNullException
(
"stream"
);
}
Trace
.
TraceInformation
(
"Begin Read"
);
//
Trace.TraceInformation("Begin Read");
using
(
var
reader
=
new
SvgTextReader
(
stream
,
entities
))
{
...
...
@@ -248,7 +248,7 @@ namespace Svg
}
}
Trace
.
TraceInformation
(
"End Read"
);
//
Trace.TraceInformation("End Read");
return
svgDocument
;
}
}
...
...
@@ -320,7 +320,7 @@ namespace Svg
/// <returns>A <see cref="Bitmap"/> containing the rendered document.</returns>
public
virtual
Bitmap
Draw
()
{
Trace
.
TraceInformation
(
"Begin Render"
);
//
Trace.TraceInformation("Begin Render");
var
size
=
GetDimensions
();
var
bitmap
=
new
Bitmap
((
int
)
Math
.
Ceiling
(
size
.
Width
),
(
int
)
Math
.
Ceiling
(
size
.
Height
));
...
...
@@ -342,7 +342,7 @@ namespace Svg
throw
;
}
Trace
.
TraceInformation
(
"End Render"
);
//
Trace.TraceInformation("End Render");
return
bitmap
;
}
...
...
SvgElementFactory.cs
View file @
26f61673
...
...
@@ -93,7 +93,7 @@ namespace Svg
SvgElement
createdElement
=
null
;
string
elementName
=
reader
.
LocalName
;
Trace
.
TraceInformation
(
"Begin CreateElement: {0}"
,
elementName
);
//
Trace.TraceInformation("Begin CreateElement: {0}", elementName);
if
(
elementName
==
"svg"
)
{
...
...
@@ -114,14 +114,14 @@ namespace Svg
SetAttributes
(
createdElement
,
reader
,
document
);
}
Trace
.
TraceInformation
(
"End CreateElement"
);
//
Trace.TraceInformation("End CreateElement");
return
createdElement
;
}
private
static
void
SetAttributes
(
SvgElement
element
,
XmlTextReader
reader
,
SvgDocument
document
)
{
Trace
.
TraceInformation
(
"Begin SetAttributes"
);
//
Trace.TraceInformation("Begin SetAttributes");
string
[]
styles
=
null
;
string
[]
style
=
null
;
...
...
@@ -151,7 +151,7 @@ namespace Svg
SetPropertyValue
(
element
,
reader
.
LocalName
,
reader
.
Value
,
document
);
}
Trace
.
TraceInformation
(
"End SetAttributes"
);
//
Trace.TraceInformation("End SetAttributes");
}
private
static
void
SetPropertyValue
(
SvgElement
element
,
string
attributeName
,
string
attributeValue
,
SvgDocument
document
)
...
...
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