diff --git a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs index 105c2f4e6..4b1d4222c 100644 --- a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs +++ b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -153,42 +153,6 @@ namespace SixLabors.ImageSharp.Advanced internal static MemoryAllocator GetMemoryAllocator(this IConfigurable source) => GetConfiguration(source).MemoryAllocator; - /// - /// Gets the span to the backing buffer. - /// - /// The type of the pixel. - /// The source. - /// The span returned from Pixel source - private static Span GetSpan(IPixelSource source) - where TPixel : struct, IPixel - => source.PixelBuffer.GetSpan(); - - /// - /// Gets the span to the backing buffer at the given row. - /// - /// The type of the pixel. - /// The source. - /// The row. - /// - /// The span returned from Pixel source - /// - private static Span GetSpan(IPixelSource source, int row) - where TPixel : struct, IPixel - => GetSpan(source.PixelBuffer, row); - - /// - /// Gets the span to the backing buffer at the given row. - /// - /// The type of the pixel. - /// The source. - /// The row. - /// - /// The span returned from Pixel source. - /// - private static Span GetSpan(Buffer2D source, int row) - where TPixel : struct, IPixel - => source.GetSpan().Slice(row * source.Width, source.Width); - /// /// Gets the configuration. /// diff --git a/src/ImageSharp/Common/Helpers/Guard.cs b/src/ImageSharp/Common/Helpers/Guard.cs index e86da78e3..310765f69 100644 --- a/src/ImageSharp/Common/Helpers/Guard.cs +++ b/src/ImageSharp/Common/Helpers/Guard.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -51,28 +51,6 @@ namespace SixLabors.ImageSharp } } - /// - /// Ensures that the enumeration is not null or empty. - /// - /// The type of objects in the - /// The target enumeration, which should be checked against being null or empty. - /// Name of the parameter. - /// is null. - /// is empty. - [MethodImpl(InliningOptions.ShortMethod)] - public static void NotNullOrEmpty(ICollection value, string parameterName) - { - if (value is null) - { - ThrowArgumentNullException(parameterName); - } - - if (value.Count == 0) - { - ThrowArgumentException("Must not be empty.", parameterName); - } - } - /// /// Ensures that the specified value is less than a maximum value. /// diff --git a/src/ImageSharp/Formats/Png/Filters/SubFilter.cs b/src/ImageSharp/Formats/Png/Filters/SubFilter.cs index 6af5f0b64..e6fc1b6ae 100644 --- a/src/ImageSharp/Formats/Png/Filters/SubFilter.cs +++ b/src/ImageSharp/Formats/Png/Filters/SubFilter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -25,12 +25,8 @@ namespace SixLabors.ImageSharp.Formats.Png.Filters ref byte scanBaseRef = ref MemoryMarshal.GetReference(scanline); // Sub(x) + Raw(x-bpp) - int x = 1; - for (; x <= bytesPerPixel /* Note the <= because x starts at 1 */; ++x) - { - ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); - } - + int x = bytesPerPixel + 1; + Unsafe.Add(ref scanBaseRef, x); for (; x < scanline.Length; ++x) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs index e40e6c26c..77c1cf2ea 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -419,16 +419,6 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif : default; } - private string ReadString(int length) - { - if (this.TryReadSpan(length, out ReadOnlySpan span) && span.Length != 0) - { - return this.ConvertToString(span); - } - - return null; - } - private void GetThumbnail(uint offset) { var values = new List(); diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs index 3f330ef72..9069f0c7b 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -526,9 +526,8 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc { int start = this.currentIndex - 8; - // TODO: Why are we storing variable - ushort inChannelCount = this.ReadUInt16(); - ushort outChannelCount = this.ReadUInt16(); + this.ReadUInt16(); + this.ReadUInt16(); uint elementCount = this.ReadUInt32(); var positionTable = new IccPositionNumber[elementCount]; @@ -902,4 +901,4 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc return new IccUcrBgTagDataEntry(ucrCurve, bgCurve, description); } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs index bbfe909e0..79542b85f 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -83,16 +83,5 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc { return ((value >> (7 - position)) & 1) == 1; } - - /// - /// Gets the bit value at a specified position - /// - /// The value from where the bit will be extracted - /// Position of the bit. Zero based index from left to right. - /// The bit value at specified position - private bool GetBit(ushort value, int position) - { - return ((value >> (15 - position)) & 1) == 1; - } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs index 8b4fa690d..4f03ed610 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs @@ -41,7 +41,6 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc public int WriteResponseCurve(IccResponseCurve value) { int count = this.WriteUInt32((uint)value.CurveType); - int channels = value.XyzValues.Length; foreach (IccResponseNumber[] responseArray in value.ResponseArrays) { diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs index e681f84b8..ce80574ad 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -37,9 +37,6 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc int minor = value.Minor.Clamp(0, 15); int bugfix = value.Patch.Clamp(0, 15); - // TODO: This is not used? - byte mb = (byte)((minor << 4) | bugfix); - int version = (major << 24) | (minor << 20) | (bugfix << 16); return this.WriteInt32(version); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs index dd1207435..b5bd14d9f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -15,7 +15,6 @@ namespace SixLabors.ImageSharp.PixelFormats public partial struct Gray16 : IPixel, IPackedVector { private const float Max = ushort.MaxValue; - private const float Average = 1 / 3F; /// /// Initializes a new instance of the struct. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.cs index 09597a949..ac67c9d17 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -16,12 +16,6 @@ namespace SixLabors.ImageSharp.PixelFormats { private static readonly Vector4 MaxBytes = new Vector4(255F); private static readonly Vector4 Half = new Vector4(0.5F); - private const float Average = 1 / 3F; - - private static readonly Vector4 Min = new Vector4(0, 0, 0, 1f); - private static readonly Vector4 Max = Vector4.One; - - private static readonly Vector4 Accumulator = new Vector4(255f * Average, 255f * Average, 255f * Average, 0.5f); /// /// Initializes a new instance of the struct. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs index 38e75d183..445f89981 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -193,11 +193,10 @@ namespace SixLabors.ImageSharp.PixelFormats /// public override string ToString() { - var vector = this.ToVector4(); return FormattableString.Invariant($"RgbaVector({this.R:#0.##}, {this.G:#0.##}, {this.B:#0.##}, {this.A:#0.##})"); } /// public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B, this.A); } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs index 7cdc37ee4..7d8ba6208 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs @@ -51,10 +51,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization { int sourceWidth = source.Width; int sourceHeight = source.Height; - int numberOfPixels = sourceWidth * sourceHeight; int tileWidth = (int)MathF.Ceiling(sourceWidth / (float)this.Tiles); int tileHeight = (int)MathF.Ceiling(sourceHeight / (float)this.Tiles); - int pixelsInTile = tileWidth * tileHeight; + int tileCount = this.Tiles; int halfTileWidth = tileWidth / 2; int halfTileHeight = tileHeight / 2; int luminanceLevels = this.LuminanceLevels; @@ -103,8 +102,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization float luminanceEqualized = InterpolateBetweenFourTiles( pixel, cdfData, - this.Tiles, - this.Tiles, + tileCount, + tileCount, tileX, tileY, cdfX, @@ -467,7 +466,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization int tileWidth = this.tileWidth; int tileHeight = this.tileHeight; int luminanceLevels = this.luminanceLevels; - MemoryAllocator memoryAllocator = this.memoryAllocator; Parallel.For( 0, @@ -543,4 +541,4 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization } } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs index 947268750..b9d867a93 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs @@ -49,8 +49,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization protected override void OnFrameApply(ImageFrame source, Rectangle sourceRectangle, Configuration configuration) { MemoryAllocator memoryAllocator = configuration.MemoryAllocator; - int numberOfPixels = source.Width * source.Height; - Span pixels = source.GetPixelSpan(); var parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism }; int tileWidth = source.Width / this.Tiles; diff --git a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs index b3a1603e6..a790263fa 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs @@ -42,7 +42,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization { MemoryAllocator memoryAllocator = configuration.MemoryAllocator; int numberOfPixels = source.Width * source.Height; - Span pixels = source.GetPixelSpan(); var workingRect = new Rectangle(0, 0, source.Width, source.Height); using (IMemoryOwner histogramBuffer = memoryAllocator.Allocate(this.LuminanceLevels, AllocationOptions.Clean)) @@ -104,4 +103,4 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization } } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs index 99178b34c..b68a7f93f 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs @@ -156,8 +156,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms return; } - int sourceHeight = source.Height; - PixelConversionModifiers conversionModifiers = PixelConversionModifiers.Premultiply.ApplyCompanding(this.Compand); diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs index d7ffb332d..2c9f4289e 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs @@ -94,8 +94,6 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization int n = Count / Vector.Count; ref Vector bf = ref Unsafe.As>(ref this.data[0]); - ref Vector bu = ref Unsafe.As, Vector>(ref bf); - var scale = new Vector(1f / 255f); for (int i = 0; i < n; i++) diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs index 5ab789435..ee95bc743 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapePath region = Assert.IsType(processor.Region); // path is converted to a polygon before filling - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); Assert.Equal(this.pen.StrokeFill, processor.Brush); } @@ -68,7 +68,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths Assert.Equal(this.noneDefault, processor.Options); ShapePath region = Assert.IsType(processor.Region); - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); Assert.Equal(this.pen.StrokeFill, processor.Brush); } @@ -86,7 +86,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths Assert.Equal(GraphicsOptions.Default, processor.Options); ShapePath region = Assert.IsType(processor.Region); - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -105,7 +105,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths Assert.Equal(this.noneDefault, processor.Options); ShapePath region = Assert.IsType(processor.Region); - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index d65dcd8c6..d12441ac2 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths // path is converted to a polygon before filling Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs index 1f8e2d423..17bb7e6ee 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -51,7 +51,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths // path is converted to a polygon before filling Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index 5af14d608..22b741ec1 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs index 572a870a4..181ec9b9d 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -14,14 +14,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text { public class DrawText : BaseImageOperationsExtensionTest { - Rgba32 color = Color.HotPink; - - SolidBrush brush = Brushes.Solid(Color.HotPink); - - IPath path = new SixLabors.Shapes.Path( - new LinearLineSegment( - new SixLabors.Primitives.PointF[] { new Vector2(10, 10), new Vector2(20, 10), new Vector2(20, 10), new Vector2(30, 10), })); - private readonly FontCollection FontCollection; private readonly Font Font; @@ -103,7 +95,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text Pens.Dash(Color.Red, 1), Vector2.Zero); - var processor = this.Verify(0); + this.Verify(0); } [Fact] @@ -111,7 +103,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text { this.operations.DrawText("123", this.Font, null, Pens.Dash(Color.Red, 1), Vector2.Zero); - var processor = this.Verify(0); + this.Verify(0); } [Fact] @@ -119,7 +111,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text { this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Pens.Dash(Color.Red, 1), Vector2.Zero); - var processor = this.Verify(0); + this.Verify(0); } [Fact] diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs index ebd9cf644..73a1114d3 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -41,21 +41,17 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text { Font font = CreateFont("OpenSans-Regular.ttf", 36); Color color = Color.Black; - float padding = 5; var text = "A short piece of text"; using (var img = provider.GetImage()) { - float targetWidth = img.Width - (padding * 2); - float targetHeight = img.Height - (padding * 2); - // measure the text size SizeF size = TextMeasurer.Measure(text, new RendererOptions(font)); //find out how much we need to scale the text to fill the space (up or down) float scalingFactor = Math.Min(img.Width / size.Width, img.Height / size.Height); - //create a new font + //create a new font Font scaledFont = new Font(font, scalingFactor * font.Size); var center = new PointF(img.Width / 2, img.Height / 2); @@ -64,7 +60,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; - + img.Mutate(i => i.DrawText(textGraphicOptions, text, scaledFont, color, center)); } } @@ -241,6 +237,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text return font; } - + } } diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs index a2623ce17..d9fff9ded 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs @@ -346,7 +346,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp public void BmpDecoder_ThrowsImageFormatException_OnInvalidPaletteSize(TestImageProvider provider) where TPixel : struct, IPixel { - Assert.Throws( () => { using (Image image = provider.GetImage(new BmpDecoder())) { } }); + Assert.Throws( () => { using (provider.GetImage(new BmpDecoder())) { } }); } [Theory] @@ -355,7 +355,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp public void BmpDecoder_ThrowsNotSupportedException_OnUnsupportedBitmaps(TestImageProvider provider) where TPixel : struct, IPixel { - Assert.Throws(() => { using (Image image = provider.GetImage(new BmpDecoder())) { } }); + Assert.Throws(() => { using (provider.GetImage(new BmpDecoder())) { } }); } [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs index 1f49b6713..6c8732b5d 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs @@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif public void CanDecodeIntermingledImages() { using (var kumin1 = Image.Load(TestFile.Create(TestImages.Gif.Kumin).Bytes)) - using (var icon = Image.Load(TestFile.Create(TestImages.Png.Icon).Bytes)) + using (Image.Load(TestFile.Create(TestImages.Png.Icon).Bytes)) using (var kumin2 = Image.Load(TestFile.Create(TestImages.Gif.Kumin).Bytes)) { for (int i = 0; i < kumin1.Frames.Count; i++) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 36a160e59..a9cddebc8 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -107,25 +107,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg provider.Configuration.MemoryAllocator.ReleaseRetainedResources(); } - private string GetDifferenceInPercentageString(Image image, TestImageProvider provider) - where TPixel : struct, IPixel - { - var reportingComparer = ImageComparer.Tolerant(0, 0); - - ImageSimilarityReport report = image.GetReferenceOutputSimilarityReports( - provider, - reportingComparer, - appendPixelTypeToFileName: false - ).SingleOrDefault(); - - if (report?.TotalNormalizedDifference != null) - { - return report.DifferencePercentageString; - } - - return "0%"; - } - // DEBUG ONLY! // The PDF.js output should be saved by "tests\ImageSharp.Tests\Formats\Jpg\pdfjs\jpeg-converter.htm" // into "\tests\Images\ActualOutput\JpegDecoderTests\" diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs index e4c7e2231..80ab860ef 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs @@ -102,7 +102,7 @@ namespace SixLabors.ImageSharp.Tests ArgumentException ex = Assert.Throws( () => { - var collection = new ImageFrameCollection( + new ImageFrameCollection( this.Image, new[] { @@ -274,7 +274,6 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void AddFrame_clones_sourceFrame() { - var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray(); var otherFrame = new ImageFrame(Configuration.Default, 10, 10); var addedFrame = this.Image.Frames.AddFrame(otherFrame); addedFrame.ComparePixelBufferTo(otherFrame.GetPixelSpan()); @@ -284,7 +283,6 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void InsertFrame_clones_sourceFrame() { - var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray(); var otherFrame = new ImageFrame(Configuration.Default, 10, 10); var addedFrame = this.Image.Frames.InsertFrame(0, otherFrame); addedFrame.ComparePixelBufferTo(otherFrame.GetPixelSpan()); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs index 975ed84e0..96747b0d2 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -25,8 +25,6 @@ namespace SixLabors.ImageSharp.Tests private byte[] ByteArray => this.DataStream.ToArray(); - private ReadOnlySpan ByteSpan => this.ByteArray.AsSpan(); - private IImageFormat LocalImageFormat => this.localImageFormatMock.Object; private static readonly IImageFormat ExpectedGlobalFormat = diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs index 92159f0c9..58e19c9f7 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs @@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Tests this.TestFormat.VerifySpecificDecodeCall(this.Marker, this.TopLevelConfiguration); } - + [Fact] public void Configuration_Path_Agnostic() { @@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration); } - + [Fact] public void Configuration_Path_Decoder_Specific() { @@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Tests Assert.NotNull(img); this.localDecoder.Verify(x => x.Decode(this.TopLevelConfiguration, this.DataStream)); } - + [Fact] public void Configuration_Path_Decoder_Agnostic() { @@ -61,10 +61,10 @@ namespace SixLabors.ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.TestFormat, format); - + this.TestFormat.VerifySpecificDecodeCall(this.Marker, this.TopLevelConfiguration); } - + [Fact] public void Configuration_Path_OutFormat_Agnostic() { @@ -72,14 +72,14 @@ namespace SixLabors.ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.TestFormat, format); - + this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration); - } - + } + [Fact] public void WhenFileNotFound_Throws() { - System.IO.FileNotFoundException ex = Assert.Throws( + Assert.Throws( () => { Image.Load(this.TopLevelConfiguration, Guid.NewGuid().ToString()); @@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void WhenPathIsNull_Throws() { - ArgumentNullException ex = Assert.Throws( + Assert.Throws( () => { Image.Load(this.TopLevelConfiguration,(string)null); @@ -97,4 +97,4 @@ namespace SixLabors.ImageSharp.Tests } } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs index 19cf7ee64..4d3a229c5 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs @@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void WhenFileNotFound_Throws() { - System.IO.FileNotFoundException ex = Assert.Throws( + Assert.Throws( () => { Image.Load(Guid.NewGuid().ToString()); @@ -92,7 +92,7 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void WhenPathIsNull_Throws() { - ArgumentNullException ex = Assert.Throws( + Assert.Throws( () => { Image.Load((string)null); @@ -100,4 +100,4 @@ namespace SixLabors.ImageSharp.Tests } } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs index 5fe87fedc..ad8dc20e4 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs @@ -18,11 +18,6 @@ namespace SixLabors.ImageSharp.Tests private ReadOnlySpan ByteSpan => this.ByteArray.AsSpan(); - private byte[] ActualImageBytes => TestFile.Create(TestImages.Bmp.F).Bytes; - - private ReadOnlySpan ActualImageSpan => this.ActualImageBytes.AsSpan(); - - [Theory] [InlineData(false)] [InlineData(true)] @@ -116,4 +111,4 @@ namespace SixLabors.ImageSharp.Tests } } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs index cbca1e000..171b681ce 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs @@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Tests { Assert.Throws(() => { - using (var img = Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) + using (Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) { } }); @@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests { Assert.Throws(() => { - using (var img = Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) + using (Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) { } }); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Save.cs b/tests/ImageSharp.Tests/Image/ImageTests.Save.cs index b8eb52d9e..66b0dd21d 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Save.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Save.cs @@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.Tests image.Save(file); } - using (var img = Image.Load(file, out IImageFormat mime)) + using (Image.Load(file, out IImageFormat mime)) { Assert.Equal("image/png", mime.DefaultMimeType); } @@ -39,7 +39,7 @@ namespace SixLabors.ImageSharp.Tests string dir = TestEnvironment.CreateOutputDirectory(nameof(ImageTests)); string file = System.IO.Path.Combine(dir, "UnknownExtensionsEncoding_Throws.tmp"); - NotSupportedException ex = Assert.Throws( + Assert.Throws( () => { using (var image = new Image(10, 10)) @@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.Tests image.Save(file, new PngEncoder()); } - using (var img = Image.Load(file, out var mime)) + using (Image.Load(file, out var mime)) { Assert.Equal("image/png", mime.DefaultMimeType); } diff --git a/tests/ImageSharp.Tests/ImageOperationTests.cs b/tests/ImageSharp.Tests/ImageOperationTests.cs index 455e2c5f1..7f8b13375 100644 --- a/tests/ImageSharp.Tests/ImageOperationTests.cs +++ b/tests/ImageSharp.Tests/ImageOperationTests.cs @@ -83,7 +83,7 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void CloneCallsImageOperationsProvider_Func_NotOnOriginal() { - Image returned = this.image.Clone(x => x.ApplyProcessor(this.processorDefinition)); + this.image.Clone(x => x.ApplyProcessor(this.processorDefinition)); Assert.False(this.provider.HasCreated(this.image)); Assert.DoesNotContain( this.processorDefinition, @@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void CloneCallsImageOperationsProvider_ListOfProcessors_NotOnOriginal() { - Image returned = this.image.Clone(this.processorDefinition); + this.image.Clone(this.processorDefinition); Assert.False(this.provider.HasCreated(this.image)); Assert.DoesNotContain( this.processorDefinition, diff --git a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs index 668e699c5..6fc5142ee 100644 --- a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs +++ b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -373,7 +373,6 @@ namespace SixLabors.ImageSharp.Tests public void ProfileToByteArray() { // arrange - byte[] exifBytesWithExifCode = ProfileResolver.ExifMarker.Concat(ExifConstants.LittleEndianByteOrderMarker).ToArray(); byte[] exifBytesWithoutExifCode = ExifConstants.LittleEndianByteOrderMarker; ExifProfile expectedProfile = CreateExifProfile(); var expectedProfileTags = expectedProfile.Values.Select(x => x.Tag).ToList(); diff --git a/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs b/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs index a1944669d..52d88afaf 100644 --- a/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs +++ b/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.Tests.Icc byte[] copy = new byte[data.Length]; Buffer.BlockCopy(data, 0, copy, 0, data.Length); - IccProfileId result = IccProfile.CalculateHash(data); + IccProfile.CalculateHash(data); Assert.Equal(data, copy); } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs index 1de274f9a..58242713c 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -816,7 +816,6 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations for (int i = 0; i < count; i++) { - int i2 = i * 2; expected[i].FromGray16(source[i]); } diff --git a/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs index 1cb7d8998..45f8e25f4 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; @@ -61,7 +61,6 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats // act var pixel = default(Short4); pixel.FromScaledVector4(scaled); - ulong actual = pixel.PackedValue; // assert Assert.Equal((ulong)expected, pixel.PackedValue); diff --git a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs index 0af8ae45f..d684198fa 100644 --- a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs +++ b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -19,37 +19,25 @@ namespace SixLabors.ImageSharp.Tests.Primitives [Fact] public void DenseMatrixThrowsOnNullInitializer() { - Assert.Throws(() => - { - var dense = new DenseMatrix(null); - }); + Assert.Throws(() => new DenseMatrix(null)); } [Fact] public void DenseMatrixThrowsOnEmptyZeroWidth() { - Assert.Throws(() => - { - var dense = new DenseMatrix(0, 10); - }); + Assert.Throws(() => new DenseMatrix(0, 10)); } [Fact] public void DenseMatrixThrowsOnEmptyZeroHeight() { - Assert.Throws(() => - { - var dense = new DenseMatrix(10, 0); - }); + Assert.Throws(() => new DenseMatrix(10, 0)); } [Fact] public void DenseMatrixThrowsOnEmptyInitializer() { - Assert.Throws(() => - { - var dense = new DenseMatrix(new float[0, 0]); - }); + Assert.Throws(() => new DenseMatrix(new float[0, 0])); } [Fact] @@ -131,4 +119,4 @@ namespace SixLabors.ImageSharp.Tests.Primitives Assert.Equal(3, transposed[2, 0]); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs index 6afcb9518..41e60c84a 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters public void BlackWhite_CorrectProcessor() { this.operations.BlackWhite(); - BlackWhiteProcessor p = this.Verify(); + this.Verify(); } [Fact] public void BlackWhite_rect_CorrectProcessor() { this.operations.BlackWhite(this.rect); - BlackWhiteProcessor p = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs index 1cfb88d3a..e287fb7b5 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Collections.Generic; @@ -31,7 +31,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters where T : IImageProcessor { this.operations.ColorBlindness(colorBlindness); - T p = this.Verify(); + this.Verify(); } [Theory] [MemberData(nameof(TheoryData))] @@ -39,7 +39,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters where T : IImageProcessor { this.operations.ColorBlindness(colorBlindness, this.rect); - T p = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs b/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs index c5eec009a..46fa61168 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using Xunit; @@ -14,14 +14,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters public void Filter_CorrectProcessor() { this.operations.Filter(KnownFilterMatrices.AchromatomalyFilter * KnownFilterMatrices.CreateHueFilter(90F)); - FilterProcessor p = this.Verify(); + this.Verify(); } [Fact] public void Filter_rect_CorrectProcessor() { this.operations.Filter(KnownFilterMatrices.AchromatomalyFilter * KnownFilterMatrices.CreateHueFilter(90F), this.rect); - FilterProcessor p = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs index d04a2272d..08de55d6b 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Collections.Generic; @@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters where T : IImageProcessor { this.operations.Grayscale(mode); - var p = this.Verify(); + this.Verify(); } [Theory] @@ -43,4 +43,4 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs b/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs index 888ee4bcb..7e8b76458 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Effects public void Invert_InvertProcessorDefaultsSet() { this.operations.Invert(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Pixelate_rect_PixelateProcessorDefaultsSet() { this.operations.Invert(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs b/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs index 1b9e1689d..c171a1243 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters public void Kodachrome_amount_KodachromeProcessorDefaultsSet() { this.operations.Kodachrome(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Kodachrome_amount_rect_KodachromeProcessorDefaultsSet() { this.operations.Kodachrome(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs index c785d1d25..a9aecaa9c 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using Xunit; @@ -14,14 +14,14 @@ namespace SixLabors.ImageSharp.Tests public void Lomograph_amount_LomographProcessorDefaultsSet() { this.operations.Lomograph(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Lomograph_amount_rect_LomographProcessorDefaultsSet() { this.operations.Lomograph(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs index d7ed7d1ff..c3e2c3c50 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Processing; @@ -14,14 +14,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters public void Polaroid_amount_PolaroidProcessorDefaultsSet() { this.operations.Polaroid(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Polaroid_amount_rect_PolaroidProcessorDefaultsSet() { this.operations.Polaroid(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs b/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs index 7ed4f5244..02e5f4276 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters public void Sepia_amount_SepiaProcessorDefaultsSet() { this.operations.Sepia(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Sepia_amount_rect_SepiaProcessorDefaultsSet() { this.operations.Sepia(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs index dc169df81..91b011ed6 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -131,7 +131,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms var referenceMap = ReferenceKernelMap.Calculate(resampler, destSize, srcSize); var kernelMap = ResizeKernelMap.Calculate(resampler, destSize, srcSize, Configuration.Default.MemoryAllocator); - + #if DEBUG this.Output.WriteLine(kernelMap.Info); @@ -239,4 +239,4 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms return result; } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs index f19029f8c..44af42347 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -249,11 +249,6 @@ namespace SixLabors.ImageSharp.Tests LocalizedString_Rand1, LocalizedString_Rand2, }; - private static readonly IccLocalizedString[] LocalizedString_RandArr2 = new IccLocalizedString[] - { - LocalizedString_Rand2, - LocalizedString_Rand1, - }; private static readonly IccMultiLocalizedUnicodeTagDataEntry MultiLocalizedUnicode_Val = new IccMultiLocalizedUnicodeTagDataEntry(LocalizedString_RandArr1); private static readonly byte[] MultiLocalizedUnicode_Arr = ArrayHelper.Concat diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 1a33efd34..63de4c96f 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -166,7 +166,6 @@ namespace SixLabors.ImageSharp.Tests public override string ToString() { - string provName = this.GetType().Name.Replace("Provider", ""); return $"{this.SourceFileOrDescription}[{this.PixelType}]"; } } diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index b49baa5c4..f589db697 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; @@ -20,17 +20,16 @@ namespace SixLabors.ImageSharp.Tests public class TestImageProviderTests { public static readonly TheoryData BasicData = new TheoryData() - { - TestImageProvider.Blank(10, 20), - TestImageProvider.Blank(10, 20), - }; + { + TestImageProvider.Blank(10, 20), + TestImageProvider.Blank(10, 20), + }; public static readonly TheoryData FileData = new TheoryData() - { - TestImageProvider.File(TestImages.Bmp.Car), - TestImageProvider.File( - TestImages.Bmp.F) - }; + { + TestImageProvider.File(TestImages.Bmp.Car), + TestImageProvider.File(TestImages.Bmp.F) + }; public static string[] AllBmpFiles = { TestImages.Bmp.F, TestImages.Bmp.Bit8 }; @@ -320,7 +319,7 @@ namespace SixLabors.ImageSharp.Tests img.DebugSave(provider); } } - + [Theory] [WithTestPatternImages(20, 20, PixelTypes.Rgba32)] public void Use_WithTestPatternImages_CustomConfiguration(TestImageProvider provider) @@ -332,13 +331,13 @@ namespace SixLabors.ImageSharp.Tests private static void EnsureCustomConfigurationIsApplied(TestImageProvider provider) where TPixel : struct, IPixel { - using (var image1 = provider.GetImage()) + using (provider.GetImage()) { var customConfiguration = Configuration.CreateDefaultInstance(); provider.Configuration = customConfiguration; - using (var image2 = provider.GetImage()) - using (var image3 = provider.GetImage()) + using (Image image2 = provider.GetImage()) + using (Image image3 = provider.GetImage()) { Assert.Same(customConfiguration, image2.GetConfiguration()); Assert.Same(customConfiguration, image3.GetConfiguration()); @@ -379,7 +378,7 @@ namespace SixLabors.ImageSharp.Tests this.callerName = name; invocationCounts[name] = 0; } - + public Image Decode(Configuration configuration, Stream stream) => this.Decode(configuration, stream); } @@ -418,8 +417,8 @@ namespace SixLabors.ImageSharp.Tests this.callerName = name; invocationCounts[name] = 0; } - + public Image Decode(Configuration configuration, Stream stream) => this.Decode(configuration, stream); } } -} \ No newline at end of file +}