Commit 11d63ae2 authored by Andreas Niedermair's avatar Andreas Niedermair
Browse files

fixed SvgImage.GetImage

parent 3bb22f1e
...@@ -88,8 +88,8 @@ namespace Svg ...@@ -88,8 +88,8 @@ namespace Svg
/// <value>The bounds.</value> /// <value>The bounds.</value>
public override RectangleF Bounds public override RectangleF Bounds
{ {
get { return new RectangleF(this.Location.ToDeviceValue(null, this), get { return new RectangleF(this.Location.ToDeviceValue(null, this),
new SizeF(this.Width.ToDeviceValue(null, UnitRenderingType.Horizontal, this), new SizeF(this.Width.ToDeviceValue(null, UnitRenderingType.Horizontal, this),
this.Height.ToDeviceValue(null, UnitRenderingType.Vertical, this))); } this.Height.ToDeviceValue(null, UnitRenderingType.Vertical, this))); }
} }
...@@ -143,10 +143,10 @@ namespace Svg ...@@ -143,10 +143,10 @@ namespace Svg
} }
var destClip = new RectangleF(this.Location.ToDeviceValue(renderer, this), var destClip = new RectangleF(this.Location.ToDeviceValue(renderer, this),
new SizeF(Width.ToDeviceValue(renderer, UnitRenderingType.Horizontal, this), new SizeF(Width.ToDeviceValue(renderer, UnitRenderingType.Horizontal, this),
Height.ToDeviceValue(renderer, UnitRenderingType.Vertical, this))); Height.ToDeviceValue(renderer, UnitRenderingType.Vertical, this)));
RectangleF destRect = destClip; RectangleF destRect = destClip;
this.PushTransforms(renderer); this.PushTransforms(renderer);
renderer.SetClip(new Region(destClip), CombineMode.Intersect); renderer.SetClip(new Region(destClip), CombineMode.Intersect);
this.SetClip(renderer); this.SetClip(renderer);
...@@ -203,7 +203,7 @@ namespace Svg ...@@ -203,7 +203,7 @@ namespace Svg
break; break;
} }
destRect = new RectangleF(destClip.X + xOffset, destClip.Y + yOffset, destRect = new RectangleF(destClip.X + xOffset, destClip.Y + yOffset,
srcRect.Width * fScaleX, srcRect.Height * fScaleY); srcRect.Width * fScaleX, srcRect.Height * fScaleY);
} }
...@@ -223,7 +223,7 @@ namespace Svg ...@@ -223,7 +223,7 @@ namespace Svg
renderer.PopBoundable(); renderer.PopBoundable();
} }
this.ResetClip(renderer); this.ResetClip(renderer);
this.PopTransforms(renderer); this.PopTransforms(renderer);
} }
...@@ -234,9 +234,22 @@ namespace Svg ...@@ -234,9 +234,22 @@ namespace Svg
protected object GetImage(string uriString) protected object GetImage(string uriString)
{ {
var uriString = this.Href;
string safeUriString;
if (uriString.Length > 65519)
{
safeUriString = uriString.Substring(0,
65519);
}
else
{
safeUriString = uriString;
}
try try
{ {
var uri = new Uri(uriString.Substring(0, 65519)); //Uri MaxLength is 65519 (https://msdn.microsoft.com/en-us/library/z6c2z492.aspx) var uri = new Uri(safeUriString); //Uri MaxLength is 65519 (https://msdn.microsoft.com/en-us/library/z6c2z492.aspx)
// handle data/uri embedded images (http://en.wikipedia.org/wiki/Data_URI_scheme) // handle data/uri embedded images (http://en.wikipedia.org/wiki/Data_URI_scheme)
if (uri.IsAbsoluteUri && uri.Scheme == "data") if (uri.IsAbsoluteUri && uri.Scheme == "data")
...@@ -268,7 +281,7 @@ namespace Svg ...@@ -268,7 +281,7 @@ namespace Svg
{ {
if (stream.CanSeek) if (stream.CanSeek)
{ {
stream.Position = 0; stream.Position = 0;
} }
if (uri.LocalPath.EndsWith(".svg", StringComparison.InvariantCultureIgnoreCase)) if (uri.LocalPath.EndsWith(".svg", StringComparison.InvariantCultureIgnoreCase))
{ {
......
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