From 942510f5a4b19ffea58cf5d81e642a9097a73250 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 18 May 2018 20:58:32 +1000 Subject: [PATCH 1/2] No need for SpanHelper now. --- .../Formats/Png/Filters/NoneFilter.cs | 5 +- src/ImageSharp/Memory/SpanHelper.cs | 48 ------------------- 2 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 src/ImageSharp/Memory/SpanHelper.cs diff --git a/src/ImageSharp/Formats/Png/Filters/NoneFilter.cs b/src/ImageSharp/Formats/Png/Filters/NoneFilter.cs index 14af8ca6a..97e16ef23 100644 --- a/src/ImageSharp/Formats/Png/Filters/NoneFilter.cs +++ b/src/ImageSharp/Formats/Png/Filters/NoneFilter.cs @@ -3,7 +3,6 @@ using System; using System.Runtime.CompilerServices; -using SixLabors.ImageSharp.Memory; namespace SixLabors.ImageSharp.Formats.Png.Filters { @@ -25,7 +24,7 @@ namespace SixLabors.ImageSharp.Formats.Png.Filters // Insert a byte before the data. result[0] = 0; result = result.Slice(1); - SpanHelper.Copy(scanline, result); + scanline.Slice(0, Math.Min(scanline.Length, result.Length)).CopyTo(result); } } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Memory/SpanHelper.cs b/src/ImageSharp/Memory/SpanHelper.cs deleted file mode 100644 index 592e2a885..000000000 --- a/src/ImageSharp/Memory/SpanHelper.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -using System; -using System.Runtime.CompilerServices; - -namespace SixLabors.ImageSharp.Memory -{ - /// - /// Utility methods for - /// - internal static class SpanHelper - { - /// - /// Copy all elements of 'source' into 'destination'. - /// - /// The element type. - /// The to copy elements from. - /// The destination . - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Copy(ReadOnlySpan source, Span destination) - where T : struct - { - source.Slice(0, Math.Min(source.Length, destination.Length)).CopyTo(destination); - } - - /// - /// Gets the size of `count` elements in bytes. - /// - /// The element type. - /// The count of the elements - /// The size in bytes as int - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int SizeOf(int count) - where T : struct => Unsafe.SizeOf() * count; - - /// - /// Gets the size of `count` elements in bytes as UInt32 - /// - /// The element type. - /// The count of the elements - /// The size in bytes as UInt32 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static uint USizeOf(int count) - where T : struct - => (uint)SizeOf(count); - } -} \ No newline at end of file From 27b1f59bdb0c7d928a085fc321f43546645f6499 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 22 May 2018 00:50:54 +1000 Subject: [PATCH 2/2] Try preview environment --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f784ef287..9b1ce2b95 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ version: 1.0.0.{build} -image: Visual Studio 2017 +image: Visual Studio 2017 Preview # prevent the double build when a branch has an active PR skip_branch_with_pr: true