diff --git a/Source/Basic Shapes/SvgCircle.cs b/Source/Basic Shapes/SvgCircle.cs
index d3fbb6df07b650c594177b9e05d4ed83109a6936..411ed3806f27e536c15e0149659572c178745a12 100644
--- a/Source/Basic Shapes/SvgCircle.cs
+++ b/Source/Basic Shapes/SvgCircle.cs
@@ -78,10 +78,10 @@ namespace Svg
///
/// Gets the bounds of the circle.
///
- /// The rectangular bounds of the circle.
- public override RectangleF Bounds
+ /// The rectangular bounds of the circle.
+ public override RectangleF CalculateBounds()
{
- get { return this.Path(null).GetBounds(); }
+ return this.Path(null).GetBounds();
}
///
diff --git a/Source/Basic Shapes/SvgEllipse.cs b/Source/Basic Shapes/SvgEllipse.cs
index 0ab1d8e03ea1c304de05f0389e92f762510f1de4..479e749ae126b40081a0386638deac976269716c 100644
--- a/Source/Basic Shapes/SvgEllipse.cs
+++ b/Source/Basic Shapes/SvgEllipse.cs
@@ -92,10 +92,10 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override RectangleF Bounds
+ /// The bounds.
+ public override RectangleF CalculateBounds()
{
- get { return this.Path(null).GetBounds(); }
+ return this.Path(null).GetBounds();
}
///
diff --git a/Source/Basic Shapes/SvgImage.cs b/Source/Basic Shapes/SvgImage.cs
index 6b4ddb9fb2ef2262143d19ddda46b04f1817b04a..4122288943d9d888b0a7934ebc18234230d94e46 100644
--- a/Source/Basic Shapes/SvgImage.cs
+++ b/Source/Basic Shapes/SvgImage.cs
@@ -76,21 +76,21 @@ namespace Svg
{
get { return this.Attributes.GetAttribute("href"); }
set { this.Attributes["href"] = value; }
- }
-
-
-
- ///
- /// Gets the bounds of the element.
- ///
- /// The bounds.
- public override RectangleF Bounds
- {
- get { return new RectangleF(this.Location.ToDeviceValue(null, this),
- new SizeF(this.Width.ToDeviceValue(null, UnitRenderingType.Horizontal, this),
- this.Height.ToDeviceValue(null, UnitRenderingType.Vertical, this))); }
- }
-
+ }
+
+
+
+ ///
+ /// Gets the bounds of the element.
+ ///
+ /// The bounds.
+ public override RectangleF CalculateBounds()
+ {
+ return new RectangleF(this.Location.ToDeviceValue(null, this),
+ new SizeF(this.Width.ToDeviceValue(null, UnitRenderingType.Horizontal, this),
+ this.Height.ToDeviceValue(null, UnitRenderingType.Vertical, this)));
+ }
+
///
/// Gets the for this element.
///
diff --git a/Source/Basic Shapes/SvgLine.cs b/Source/Basic Shapes/SvgLine.cs
index 301a8de4a0e8afef8ac30e13d7ec9ccdb8ae7798..809833f39744680a2f56ef0458c64346b8ebd011 100644
--- a/Source/Basic Shapes/SvgLine.cs
+++ b/Source/Basic Shapes/SvgLine.cs
@@ -171,9 +171,9 @@ namespace Svg
return result;
}
- public override System.Drawing.RectangleF Bounds
+ public override RectangleF CalculateBounds()
{
- get { return this.Path(null).GetBounds(); }
+ return this.Path(null).GetBounds();
}
public override SvgElement DeepCopy()
diff --git a/Source/Basic Shapes/SvgPolygon.cs b/Source/Basic Shapes/SvgPolygon.cs
index 4d5563becfcd2feee63b5fb35f95066eb83eef92..e7d407edc368a8b3932e33402bcb25f3e345fc60 100644
--- a/Source/Basic Shapes/SvgPolygon.cs
+++ b/Source/Basic Shapes/SvgPolygon.cs
@@ -130,9 +130,9 @@ namespace Svg
return result;
}
- public override RectangleF Bounds
+ public override RectangleF CalculateBounds()
{
- get { return this.Path(null).GetBounds(); }
+ return this.Path(null).GetBounds();
}
diff --git a/Source/Basic Shapes/SvgRectangle.cs b/Source/Basic Shapes/SvgRectangle.cs
index c46855634d354eb5f4c403e865e6a6119db0b9d7..08a7f00bb83c1d7a5085f1764430f28623dd57e6 100644
--- a/Source/Basic Shapes/SvgRectangle.cs
+++ b/Source/Basic Shapes/SvgRectangle.cs
@@ -165,10 +165,10 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override RectangleF Bounds
+ /// The bounds.
+ public override RectangleF CalculateBounds()
{
- get { return Path(null).GetBounds(); }
+ return Path(null).GetBounds();
}
///
diff --git a/Source/Basic Shapes/SvgVisualElement.cs b/Source/Basic Shapes/SvgVisualElement.cs
index a1f87cb586b33bb39f85970e3d5410dbc82254ce..8cd6ceece583ca1474707995b697f9a5a7277ca7 100644
--- a/Source/Basic Shapes/SvgVisualElement.cs
+++ b/Source/Basic Shapes/SvgVisualElement.cs
@@ -19,27 +19,11 @@ namespace Svg
///
public abstract GraphicsPath Path(ISvgRenderer renderer);
- PointF ISvgBoundable.Location
- {
- get
- {
- return Bounds.Location;
- }
- }
-
- SizeF ISvgBoundable.Size
- {
- get
- {
- return Bounds.Size;
- }
- }
-
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public abstract RectangleF Bounds { get; }
+ /// The bounds.
+ public abstract RectangleF CalculateBounds();
///
/// Gets the associated if one has been specified.
diff --git a/Source/DataTypes/SvgUnit.cs b/Source/DataTypes/SvgUnit.cs
index f5a8f12ee4e9d6119be756e2dd415a65ef430357..d98fa79d114a74a36bf31613828ccbd3646ef185 100644
--- a/Source/DataTypes/SvgUnit.cs
+++ b/Source/DataTypes/SvgUnit.cs
@@ -149,7 +149,7 @@ namespace Svg
break;
}
- System.Drawing.SizeF size = boundable.Bounds.Size;
+ System.Drawing.SizeF size = boundable.CalculateBounds().Size;
switch (renderType)
{
@@ -157,13 +157,13 @@ namespace Svg
_deviceValue = (size.Width / 100) * value;
break;
case UnitRenderingType.HorizontalOffset:
- _deviceValue = (size.Width / 100) * value + boundable.Location.X;
+ _deviceValue = (size.Width / 100) * value + boundable.CalculateBounds().Location.X;
break;
case UnitRenderingType.Vertical:
_deviceValue = (size.Height / 100) * value;
break;
case UnitRenderingType.VerticalOffset:
- _deviceValue = (size.Height / 100) * value + boundable.Location.Y;
+ _deviceValue = (size.Height / 100) * value + boundable.CalculateBounds().Location.Y;
break;
default:
_deviceValue = (float)(Math.Sqrt(Math.Pow(size.Width, 2) + Math.Pow(size.Height, 2)) / Math.Sqrt(2) * value / 100.0);
diff --git a/Source/Document Structure/SvgFragment.cs b/Source/Document Structure/SvgFragment.cs
index 6233669f1a7bb36380946ff58be2a839de40da9b..70e621559cbb38bf73585163a5be24d34fd0d613 100644
--- a/Source/Document Structure/SvgFragment.cs
+++ b/Source/Document Structure/SvgFragment.cs
@@ -15,28 +15,9 @@ namespace Svg
///
public static readonly Uri Namespace = new Uri("http://www.w3.org/2000/svg");
- PointF ISvgBoundable.Location
+ RectangleF ISvgBoundable.CalculateBounds()
{
- get
- {
- return PointF.Empty;
- }
- }
-
- SizeF ISvgBoundable.Size
- {
- get
- {
- return GetDimensions();
- }
- }
-
- RectangleF ISvgBoundable.Bounds
- {
- get
- {
- return new RectangleF(((ISvgBoundable)this).Location, ((ISvgBoundable)this).Size);
- }
+ return new RectangleF(PointF.Empty, GetDimensions());
}
private SvgUnit _x;
@@ -185,32 +166,29 @@ namespace Svg
break;
}
}
-
+
///
/// Gets the for this element.
///
///
- public GraphicsPath Path
+ public GraphicsPath CreatePath()
{
- get
- {
- var path = new GraphicsPath();
+ var path = new GraphicsPath();
- AddPaths(this, path);
-
- return path;
- }
+ AddPaths(this, path);
+
+ return path;
}
-
+
///
/// Gets the bounds of the svg element.
///
- /// The bounds.
- public RectangleF Bounds
- {
- get
+ /// The bounds.
+ public RectangleF CalculateBounds()
+ {
+ using (var path = CreatePath())
{
- return this.Path.GetBounds();
+ return path.GetBounds();
}
}
@@ -242,7 +220,7 @@ namespace Svg
}
else
{
- bounds = this.Bounds; //do just one call to the recursive bounds property
+ bounds = this.CalculateBounds(); //do just one call to the expensive bounds calculation method
}
}
diff --git a/Source/Document Structure/SvgGroup.cs b/Source/Document Structure/SvgGroup.cs
index 63889c67a7d11e89695ca807492e6cb1f8c15e22..2c6382295add48461255fbb1819b2e4f623027a0 100644
--- a/Source/Document Structure/SvgGroup.cs
+++ b/Source/Document Structure/SvgGroup.cs
@@ -21,35 +21,32 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override System.Drawing.RectangleF Bounds
+ /// The bounds.
+ public override RectangleF CalculateBounds()
{
- get
- {
- var r = new RectangleF();
- foreach(var c in this.Children)
+ var r = new RectangleF();
+ foreach (var c in this.Children)
+ {
+ if (c is SvgVisualElement)
{
- if (c is SvgVisualElement)
+ // First it should check if rectangle is empty or it will return the wrong Bounds.
+ // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
+ if (r.IsEmpty)
{
- // First it should check if rectangle is empty or it will return the wrong Bounds.
- // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
- if (r.IsEmpty)
- {
- r = ((SvgVisualElement)c).Bounds;
- }
- else
+ r = ((SvgVisualElement) c).CalculateBounds();
+ }
+ else
+ {
+ var childBounds = ((SvgVisualElement) c).CalculateBounds();
+ if (!childBounds.IsEmpty)
{
- var childBounds = ((SvgVisualElement)c).Bounds;
- if (!childBounds.IsEmpty)
- {
- r = RectangleF.Union(r, childBounds);
- }
+ r = RectangleF.Union(r, childBounds);
}
}
}
-
- return r;
}
+
+ return r;
}
protected override bool Renderable { get { return false; } }
diff --git a/Source/Document Structure/SvgSwitch.cs b/Source/Document Structure/SvgSwitch.cs
index d07dabb00825c4ad9ca558ba3b140557ae1c0ec4..beab5c001dcd9b7359ae18cde3a6cd79de5920a6 100644
--- a/Source/Document Structure/SvgSwitch.cs
+++ b/Source/Document Structure/SvgSwitch.cs
@@ -25,35 +25,32 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override System.Drawing.RectangleF Bounds
+ /// The bounds.
+ public override RectangleF CalculateBounds()
{
- get
+ var r = new RectangleF();
+ foreach (var c in this.Children)
{
- var r = new RectangleF();
- foreach (var c in this.Children)
+ if (c is SvgVisualElement)
{
- if (c is SvgVisualElement)
+ // First it should check if rectangle is empty or it will return the wrong Bounds.
+ // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
+ if (r.IsEmpty)
{
- // First it should check if rectangle is empty or it will return the wrong Bounds.
- // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
- if (r.IsEmpty)
- {
- r = ((SvgVisualElement)c).Bounds;
- }
- else
+ r = ((SvgVisualElement) c).CalculateBounds();
+ }
+ else
+ {
+ var childBounds = ((SvgVisualElement) c).CalculateBounds();
+ if (!childBounds.IsEmpty)
{
- var childBounds = ((SvgVisualElement)c).Bounds;
- if (!childBounds.IsEmpty)
- {
- r = RectangleF.Union(r, childBounds);
- }
+ r = RectangleF.Union(r, childBounds);
}
}
}
-
- return r;
}
+
+ return r;
}
///
diff --git a/Source/Document Structure/SvgSymbol.cs b/Source/Document Structure/SvgSymbol.cs
index 97661f968f105759a9446e4c971032fbe05a84cb..3211fe9047e7145ece06b5c0e14aaf3c8a12a2da 100644
--- a/Source/Document Structure/SvgSymbol.cs
+++ b/Source/Document Structure/SvgSymbol.cs
@@ -48,34 +48,31 @@ namespace Svg.Document_Structure
/// Gets the bounds of the element.
///
/// The bounds.
- public override System.Drawing.RectangleF Bounds
+ public override System.Drawing.RectangleF CalculateBounds()
{
- get
+ var r = new RectangleF();
+ foreach (var c in this.Children)
{
- var r = new RectangleF();
- foreach (var c in this.Children)
+ if (c is SvgVisualElement)
{
- if (c is SvgVisualElement)
+ // First it should check if rectangle is empty or it will return the wrong Bounds.
+ // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
+ if (r.IsEmpty)
{
- // First it should check if rectangle is empty or it will return the wrong Bounds.
- // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
- if (r.IsEmpty)
- {
- r = ((SvgVisualElement)c).Bounds;
- }
- else
+ r = ((SvgVisualElement)c).CalculateBounds();
+ }
+ else
+ {
+ var childBounds = ((SvgVisualElement)c).CalculateBounds();
+ if (!childBounds.IsEmpty)
{
- var childBounds = ((SvgVisualElement)c).Bounds;
- if (!childBounds.IsEmpty)
- {
- r = RectangleF.Union(r, childBounds);
- }
+ r = RectangleF.Union(r, childBounds);
}
}
}
-
- return r;
}
+
+ return r;
}
protected override bool Renderable { get { return false; } }
diff --git a/Source/Document Structure/SvgUse.cs b/Source/Document Structure/SvgUse.cs
index 3ed957d63b81f2ae7b4a315bdd3f9aee646e1408..487c35259765a47eb6c686b6e3e47e8f19c56ff9 100644
--- a/Source/Document Structure/SvgUse.cs
+++ b/Source/Document Structure/SvgUse.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Text;
using System.Web;
using System.Xml;
@@ -61,9 +62,9 @@ namespace Svg
return (element != null) ? element.Path(renderer) : null;
}
- public override System.Drawing.RectangleF Bounds
+ public override RectangleF CalculateBounds()
{
- get { return new System.Drawing.RectangleF(); }
+ return new System.Drawing.RectangleF();
}
protected override bool Renderable { get { return false; } }
diff --git a/Source/Extensibility/SvgForeignObject.cs b/Source/Extensibility/SvgForeignObject.cs
index dd19031a3ca34b1ebba4fb948a04e3ed2202f92f..84a98ea4bd4c7fe14387f9d5d0412131ca5531cd 100644
--- a/Source/Extensibility/SvgForeignObject.cs
+++ b/Source/Extensibility/SvgForeignObject.cs
@@ -25,35 +25,32 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override System.Drawing.RectangleF Bounds
+ /// The bounds.
+ public override RectangleF CalculateBounds()
{
- get
+ var r = new RectangleF();
+ foreach (var c in this.Children)
{
- var r = new RectangleF();
- foreach (var c in this.Children)
+ if (c is SvgVisualElement)
{
- if (c is SvgVisualElement)
+ // First it should check if rectangle is empty or it will return the wrong Bounds.
+ // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
+ if (r.IsEmpty)
{
- // First it should check if rectangle is empty or it will return the wrong Bounds.
- // This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
- if (r.IsEmpty)
- {
- r = ((SvgVisualElement)c).Bounds;
- }
- else
+ r = ((SvgVisualElement) c).CalculateBounds();
+ }
+ else
+ {
+ var childBounds = ((SvgVisualElement) c).CalculateBounds();
+ if (!childBounds.IsEmpty)
{
- var childBounds = ((SvgVisualElement)c).Bounds;
- if (!childBounds.IsEmpty)
- {
- r = RectangleF.Union(r, childBounds);
- }
+ r = RectangleF.Union(r, childBounds);
}
}
}
-
- return r;
}
+
+ return r;
}
protected override bool Renderable { get { return false; } }
diff --git a/Source/Painting/GenericBoundable.cs b/Source/Painting/GenericBoundable.cs
index 5073d9d7c2242acfa2af87cf1536821b6097f0bb..8f52527670383f3fecf45ca99186e04198079955 100644
--- a/Source/Painting/GenericBoundable.cs
+++ b/Source/Painting/GenericBoundable.cs
@@ -19,19 +19,9 @@ namespace Svg
_rect = new RectangleF(x, y, width, height);
}
- public System.Drawing.PointF Location
+ public RectangleF CalculateBounds()
{
- get { return _rect.Location; }
- }
-
- public System.Drawing.SizeF Size
- {
- get { return _rect.Size; }
- }
-
- public System.Drawing.RectangleF Bounds
- {
- get { return _rect; }
+ return _rect;
}
}
}
diff --git a/Source/Painting/ISvgBoundable.cs b/Source/Painting/ISvgBoundable.cs
index 7bbb6097759ae132f675f8dc7f63906343c91e37..1d4917babe135b0041cc0d8f60442460a64ab346 100644
--- a/Source/Painting/ISvgBoundable.cs
+++ b/Source/Painting/ISvgBoundable.cs
@@ -4,19 +4,6 @@ namespace Svg
{
public interface ISvgBoundable
{
- PointF Location
- {
- get;
- }
-
- SizeF Size
- {
- get;
- }
-
- RectangleF Bounds
- {
- get;
- }
+ RectangleF CalculateBounds();
}
}
\ No newline at end of file
diff --git a/Source/Painting/ImmutableBoundable.cs b/Source/Painting/ImmutableBoundable.cs
new file mode 100644
index 0000000000000000000000000000000000000000..8c2a1ef69043aede801786981c0b91f1f0c5d0c8
--- /dev/null
+++ b/Source/Painting/ImmutableBoundable.cs
@@ -0,0 +1,19 @@
+using System.Drawing;
+
+namespace Svg
+{
+ internal sealed class ImmutableBoundable : ISvgBoundable
+ {
+ private readonly RectangleF bounds;
+
+ public ImmutableBoundable(ISvgBoundable boundable)
+ {
+ bounds = boundable.CalculateBounds();
+ }
+
+ public RectangleF CalculateBounds()
+ {
+ return bounds;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/Painting/SvgGradientServer.cs b/Source/Painting/SvgGradientServer.cs
index 37a1179d5126896bb0166fa8eda6bb47d074ab96..a142e77f97f495cbab980488b092951c4d5e0ba1 100644
--- a/Source/Painting/SvgGradientServer.cs
+++ b/Source/Painting/SvgGradientServer.cs
@@ -178,7 +178,7 @@ namespace Svg
for (int i = 0; i < colourBlends; i++)
{
var currentStop = this.Stops[radial ? this.Stops.Count - 1 - actualStops : actualStops];
- var boundWidth = renderer.GetBoundable().Bounds.Width;
+ var boundWidth = renderer.GetBoundable().CalculateBounds().Width;
mergedOpacity = opacity * currentStop.GetOpacity();
position =
diff --git a/Source/Painting/SvgLinearGradientServer.cs b/Source/Painting/SvgLinearGradientServer.cs
index e373aaeeb43e50de6d5c2233bf18e146a52dfdad..45f857748b79ae80fea9e781ab8dd89cbdb27ea5 100644
--- a/Source/Painting/SvgLinearGradientServer.cs
+++ b/Source/Painting/SvgLinearGradientServer.cs
@@ -191,7 +191,7 @@ namespace Svg
private LinePoints PointsToMove(ISvgBoundable boundable, PointF specifiedStart, PointF specifiedEnd)
{
- var bounds = boundable.Bounds;
+ var bounds = boundable.CalculateBounds();
if (specifiedStart.X == specifiedEnd.X)
{
return (bounds.Top < specifiedStart.Y && specifiedStart.Y < bounds.Bottom ? LinePoints.Start : LinePoints.None) |
@@ -227,7 +227,7 @@ namespace Svg
return new GradientPoints(specifiedStart, specifiedEnd);
}
- var bounds = boundable.Bounds;
+ var bounds = boundable.CalculateBounds();
var effectiveStart = specifiedStart;
var effectiveEnd = specifiedEnd;
var intersectionPoints = CandidateIntersections(bounds, specifiedStart, specifiedEnd);
diff --git a/Source/Painting/SvgMarker.cs b/Source/Painting/SvgMarker.cs
index dac9f1ca358bd44bde48bbb632f2337450ca2bae..45807550b4265aa38941d01af42e2d69f604f9b2 100644
--- a/Source/Painting/SvgMarker.cs
+++ b/Source/Painting/SvgMarker.cs
@@ -95,15 +95,12 @@ namespace Svg
return null;
}
- public override System.Drawing.RectangleF Bounds
+ public override RectangleF CalculateBounds()
{
- get
- {
- var path = this.Path(null);
- if (path != null)
- return path.GetBounds();
- return new System.Drawing.RectangleF();
- }
+ var path = this.Path(null);
+ if (path != null)
+ return path.GetBounds();
+ return new System.Drawing.RectangleF();
}
public override SvgElement DeepCopy()
diff --git a/Source/Painting/SvgRadialGradientServer.cs b/Source/Painting/SvgRadialGradientServer.cs
index 981a51fb7d5cb53854b7fc550e2806c19d1860dc..c88b9a4ea7125af3d5d0f3b633711194e726fc1d 100644
--- a/Source/Painting/SvgRadialGradientServer.cs
+++ b/Source/Painting/SvgRadialGradientServer.cs
@@ -127,7 +127,7 @@ namespace Svg
using (var transform = EffectiveGradientTransform)
{
- var bounds = renderer.GetBoundable().Bounds;
+ var bounds = renderer.GetBoundable().CalculateBounds();
transform.Translate(bounds.X, bounds.Y, MatrixOrder.Prepend);
if (this.GradientUnits == SvgCoordinateUnits.ObjectBoundingBox)
{
diff --git a/Source/Paths/SvgPath.cs b/Source/Paths/SvgPath.cs
index cb0858ffeb4e446c7d468e25eff25c3b7f90889a..d793a54f1e82bb8564ebfbeed587d06b32c7bccf 100644
--- a/Source/Paths/SvgPath.cs
+++ b/Source/Paths/SvgPath.cs
@@ -114,10 +114,10 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override System.Drawing.RectangleF Bounds
+ /// The bounds.
+ public override RectangleF CalculateBounds()
{
- get { return this.Path(null).GetBounds(); }
+ return this.Path(null).GetBounds();
}
///
diff --git a/Source/Rendering/SvgRenderer.cs b/Source/Rendering/SvgRenderer.cs
index 6d5fbde47a13fc583dd9c3535497f2500d7d7e11..f27ba40a41d3b793dc5d0faa9fa8a5fdb5e4f1a0 100644
--- a/Source/Rendering/SvgRenderer.cs
+++ b/Source/Rendering/SvgRenderer.cs
@@ -18,7 +18,7 @@ namespace Svg
public void SetBoundable(ISvgBoundable boundable)
{
- _boundables.Push(boundable);
+ _boundables.Push(new ImmutableBoundable(boundable));
}
public ISvgBoundable GetBoundable()
{
diff --git a/Source/Svg.csproj b/Source/Svg.csproj
index ea132a119e11395dd05e6a30dd2e8252005a1aa7..bde727de4ea79496a7dcb1c2409ba8017f2d51fd 100644
--- a/Source/Svg.csproj
+++ b/Source/Svg.csproj
@@ -109,6 +109,7 @@
+
diff --git a/Source/SvgElement.cs b/Source/SvgElement.cs
index b1dee4d2c9fdb71dbbe58e208083da3278fa21ac..c91870c1b57bd3831994098cfaa3b28703ef65b8 100644
--- a/Source/SvgElement.cs
+++ b/Source/SvgElement.cs
@@ -1162,4 +1162,4 @@ namespace Svg
void Render(ISvgRenderer renderer);
}
-}
\ No newline at end of file
+}
diff --git a/Source/Text/SvgGlyph.cs b/Source/Text/SvgGlyph.cs
index bd1045b7b1b27911c3424c16e46424db665ad1c8..741810255de6a7b55d35de55bb750d7d6f7c72eb 100644
--- a/Source/Text/SvgGlyph.cs
+++ b/Source/Text/SvgGlyph.cs
@@ -91,10 +91,10 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override System.Drawing.RectangleF Bounds
+ /// The bounds.
+ public override System.Drawing.RectangleF CalculateBounds()
{
- get { return this.Path(null).GetBounds(); }
+ return this.Path(null).GetBounds();
}
///
diff --git a/Source/Text/SvgTextBase.cs b/Source/Text/SvgTextBase.cs
index 83df4de4cc132694b9b420db6deb0346e8d2df3f..1020e9831408feede4917f84546c1874d2b13fc6 100644
--- a/Source/Text/SvgTextBase.cs
+++ b/Source/Text/SvgTextBase.cs
@@ -227,18 +227,15 @@ namespace Svg
///
/// Gets the bounds of the element.
///
- /// The bounds.
- public override System.Drawing.RectangleF Bounds
+ /// The bounds.
+ public override RectangleF CalculateBounds()
{
- get
+ var path = this.Path(null);
+ foreach (var elem in this.Children.OfType())
{
- var path = this.Path(null);
- foreach (var elem in this.Children.OfType())
- {
- path.AddPath(elem.Path(null), false);
- }
- return path.GetBounds();
+ path.AddPath(elem.Path(null), false);
}
+ return path.GetBounds();
}
///
@@ -495,19 +492,9 @@ namespace Svg
_width = width;
}
- public PointF Location
- {
- get { return PointF.Empty; }
- }
-
- public SizeF Size
- {
- get { return new SizeF(_width, _font.Size); }
- }
-
- public RectangleF Bounds
+ public RectangleF CalculateBounds()
{
- get { return new RectangleF(this.Location, this.Size); }
+ return new RectangleF(PointF.Empty, new SizeF(_width, _font.Size));
}
}