From abc62bbe7f3899598958536eb152d56aa68ab5bf Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sat, 26 Aug 2017 16:08:40 +0200 Subject: [PATCH] move jpeg SpanExtensions into test utils --- .../Jpg/Utils/JpegUtilityTestFixture.cs | 2 +- .../Formats/Jpg/Utils/SpanExtensions.cs | 40 ++----------------- .../ImageSharp.Tests/ImageSharp.Tests.csproj | 1 - 3 files changed, 4 insertions(+), 39 deletions(-) rename src/ImageSharp/Formats/Jpeg/GolangPort/Utils/MutableSpanExtensions.cs => tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs (75%) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegUtilityTestFixture.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegUtilityTestFixture.cs index ecebc58a5..51c99d261 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegUtilityTestFixture.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegUtilityTestFixture.cs @@ -77,7 +77,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils } internal static float[] Create8x8RandomFloatData(int minValue, int maxValue, int seed = 42) - => ImageSharp.Formats.Jpeg.GolangPort.Utils.SpanExtensions.ConvertAllToFloat(Create8x8RandomIntData(minValue, maxValue, seed)); + => SpanExtensions.ConvertAllToFloat(Create8x8RandomIntData(minValue, maxValue, seed)); internal void Print8x8Data(T[] data) => this.Print8x8Data(new Span(data)); diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Utils/MutableSpanExtensions.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs similarity index 75% rename from src/ImageSharp/Formats/Jpeg/GolangPort/Utils/MutableSpanExtensions.cs rename to tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs index 451c7276e..988b9e478 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Utils/MutableSpanExtensions.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs @@ -1,12 +1,11 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Utils +namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils { using System; + using System.Numerics; + using System.Runtime.CompilerServices; /// /// Span Extensions @@ -85,22 +84,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Utils return result; } - /// - /// Converts all float values of src to int - /// - /// Source - /// A new with float values - public static Span ConvertToInt32Span(this Span src) - { - int[] result = new int[src.Length]; - for (int i = 0; i < src.Length; i++) - { - result[i] = (int)src[i]; - } - - return result; - } - /// /// Add a scalar to all values of src /// @@ -134,22 +117,5 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Utils return result; } - - /// - /// Copy all values in src to a new instance - /// - /// Element type - /// The source - /// A new instance of - public static Span Copy(this Span src) - { - T[] result = new T[src.Length]; - for (int i = 0; i < src.Length; i++) - { - result[i] = src[i]; - } - - return result; - } } } diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj index 90d4a1f75..e8a6e8c59 100644 --- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj +++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj @@ -40,6 +40,5 @@ - \ No newline at end of file