Commit 5bd751c6 authored by Tebjan Halm's avatar Tebjan Halm
Browse files

Merge pull request #100 from vvvv/revert-97-BoundsPerformance

Revert "Performance Improvement"
parents 13132300 ae333749
...@@ -127,7 +127,7 @@ namespace Svg ...@@ -127,7 +127,7 @@ namespace Svg
using (var transform = EffectiveGradientTransform) using (var transform = EffectiveGradientTransform)
{ {
var bounds = renderer.GetBoundable().CalculateBounds(); var bounds = renderer.GetBoundable().Bounds;
transform.Translate(bounds.X, bounds.Y, MatrixOrder.Prepend); transform.Translate(bounds.X, bounds.Y, MatrixOrder.Prepend);
if (this.GradientUnits == SvgCoordinateUnits.ObjectBoundingBox) if (this.GradientUnits == SvgCoordinateUnits.ObjectBoundingBox)
{ {
......
...@@ -114,10 +114,10 @@ namespace Svg ...@@ -114,10 +114,10 @@ namespace Svg
/// <summary> /// <summary>
/// Gets the bounds of the element. /// Gets the bounds of the element.
/// </summary> /// </summary>
/// <returns>The bounds.</returns> /// <value>The bounds.</value>
public override RectangleF CalculateBounds() public override System.Drawing.RectangleF Bounds
{ {
return this.Path(null).GetBounds(); get { return this.Path(null).GetBounds(); }
} }
/// <summary> /// <summary>
......
...@@ -18,7 +18,7 @@ namespace Svg ...@@ -18,7 +18,7 @@ namespace Svg
public void SetBoundable(ISvgBoundable boundable) public void SetBoundable(ISvgBoundable boundable)
{ {
_boundables.Push(new ImmutableBoundable(boundable)); _boundables.Push(boundable);
} }
public ISvgBoundable GetBoundable() public ISvgBoundable GetBoundable()
{ {
......
...@@ -109,7 +109,6 @@ ...@@ -109,7 +109,6 @@
<Compile Include="Document Structure\SvgSymbol.cs" /> <Compile Include="Document Structure\SvgSymbol.cs" />
<Compile Include="Filter Effects\ImageBuffer.cs" /> <Compile Include="Filter Effects\ImageBuffer.cs" />
<Compile Include="Painting\GenericBoundable.cs" /> <Compile Include="Painting\GenericBoundable.cs" />
<Compile Include="Painting\ImmutableBoundable.cs" />
<Compile Include="Painting\SvgFallbackPaintServer .cs" /> <Compile Include="Painting\SvgFallbackPaintServer .cs" />
<Compile Include="Paths\CoordinateParser.cs" /> <Compile Include="Paths\CoordinateParser.cs" />
<Compile Include="Rendering\IGraphicsProvider.cs" /> <Compile Include="Rendering\IGraphicsProvider.cs" />
......
...@@ -91,10 +91,10 @@ namespace Svg ...@@ -91,10 +91,10 @@ namespace Svg
/// <summary> /// <summary>
/// Gets the bounds of the element. /// Gets the bounds of the element.
/// </summary> /// </summary>
/// <returns>The bounds.</returns> /// <value>The bounds.</value>
public override System.Drawing.RectangleF CalculateBounds() public override System.Drawing.RectangleF Bounds
{ {
return this.Path(null).GetBounds(); get { return this.Path(null).GetBounds(); }
} }
/// <summary> /// <summary>
......
...@@ -227,8 +227,10 @@ namespace Svg ...@@ -227,8 +227,10 @@ namespace Svg
/// <summary> /// <summary>
/// Gets the bounds of the element. /// Gets the bounds of the element.
/// </summary> /// </summary>
/// <returns>The bounds.</returns> /// <value>The bounds.</value>
public override RectangleF CalculateBounds() public override System.Drawing.RectangleF Bounds
{
get
{ {
var path = this.Path(null); var path = this.Path(null);
foreach (var elem in this.Children.OfType<SvgVisualElement>()) foreach (var elem in this.Children.OfType<SvgVisualElement>())
...@@ -237,6 +239,7 @@ namespace Svg ...@@ -237,6 +239,7 @@ namespace Svg
} }
return path.GetBounds(); return path.GetBounds();
} }
}
/// <summary> /// <summary>
/// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object. /// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object.
...@@ -492,9 +495,19 @@ namespace Svg ...@@ -492,9 +495,19 @@ namespace Svg
_width = width; _width = width;
} }
public RectangleF CalculateBounds() public PointF Location
{
get { return PointF.Empty; }
}
public SizeF Size
{
get { return new SizeF(_width, _font.Size); }
}
public RectangleF Bounds
{ {
return new RectangleF(PointF.Empty, new SizeF(_width, _font.Size)); get { return new RectangleF(this.Location, this.Size); }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment