From cb57122c0245fa76cf7468fe9abd1c33b7806fd1 Mon Sep 17 00:00:00 2001 From: Konstantin Petukhov Date: Thu, 20 May 2021 15:43:19 +0700 Subject: [PATCH] Fixed the issue with OutOfMemoryException when render svg with 'large' viewBox The size of final image to be equals to size of svg but not size of viewBox. The viewBox may be " 0 50000 50000" and than you'll fail to create the final bitmap. --- src/UkooLabs.SVGSharpie/SvgSvgElement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UkooLabs.SVGSharpie/SvgSvgElement.cs b/src/UkooLabs.SVGSharpie/SvgSvgElement.cs index 1575952..4ed498b 100644 --- a/src/UkooLabs.SVGSharpie/SvgSvgElement.cs +++ b/src/UkooLabs.SVGSharpie/SvgSvgElement.cs @@ -127,9 +127,9 @@ public string ViewBoxAsString set => ViewBox = string.IsNullOrEmpty(value) ? (SvgRect?)null : SvgRect.Parse(value); } - public float ViewWidth => ViewBox?.Width ?? (WidthAsLength?.Value ?? 0); + public float ViewWidth => WidthAsLength?.Value ?? (ViewBox?.Width ?? 0); - public float ViewHeight => ViewBox?.Height ?? (HeightAsLength?.Value ?? 0); + public float ViewHeight => HeightAsLength?.Value ?? (ViewBox?.Height ?? 0); public override string ToString() => $"{string.Join(string.Empty, Children)}";