From f03d0e9a4fe5ed570b97d42aadcba54716dedd2e Mon Sep 17 00:00:00 2001 From: lindexi Date: Fri, 13 Apr 2018 08:54:05 +0800 Subject: [PATCH] remove comment --- src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs b/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs index a0fd3c0172..124e33c5a3 100644 --- a/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs +++ b/src/Windows/Avalonia.Direct2D1/PrimitiveExtensions.cs @@ -127,15 +127,14 @@ namespace Avalonia.Direct2D1 EndCap = pen.EndLineCap.ToDirect2D(), DashCap = pen.DashCap.ToDirect2D() }; - float[] dashes = null;//If we new an array first that we may waste it when we use `dashes = pen.DashStyle.Dashes.Select(x => (float)x).ToArray()`. As a frequently used code I think this optimize is necessary. + float[] dashes = null; if (pen.DashStyle?.Dashes != null && pen.DashStyle.Dashes.Count > 0) { properties.DashStyle = DashStyle.Custom; - properties.DashOffset = (float) pen.DashStyle.Offset; + properties.DashOffset = (float)pen.DashStyle.Offset; dashes = pen.DashStyle.Dashes.Select(x => (float)x).ToArray(); } - //If we don't enter the code above that it is null. We should set it a default value to solve the null exception. dashes = dashes ?? Array.Empty(); return new StrokeStyle(factory, properties, dashes);