Browse Source

use var where apparent (#972)

* use var where apparent

* use var where apparent

* should use Rgb24
af/merge-core
Simon Cropp 7 years ago
committed by James Jackson-South
parent
commit
bcbd4726a6
  1. 2
      README.md
  2. 4
      src/ImageSharp.Drawing/Processing/DrawingHelpers.cs
  3. 4
      src/ImageSharp/Common/Extensions/StreamExtensions.cs
  4. 12
      src/ImageSharp/Common/Helpers/SimdUtils.BasicIntrinsics256.cs
  5. 6
      src/ImageSharp/Common/Helpers/SimdUtils.ExtendedIntrinsics.cs
  6. 6
      src/ImageSharp/Common/Helpers/SimdUtils.cs
  7. 20
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
  8. 4
      src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
  9. 6
      src/ImageSharp/Formats/Gif/LzwDecoder.cs
  10. 4
      src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs
  11. 12
      src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs
  12. 20
      src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt
  13. 6
      src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs
  14. 6
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
  15. 6
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  16. 2
      src/ImageSharp/ImageFrameCollection{TPixel}.cs
  17. 2
      src/ImageSharp/MetaData/Profiles/Exif/ExifWriter.cs
  18. 14
      src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Curves.cs
  19. 14
      src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Lut.cs
  20. 6
      src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Matrix.cs
  21. 4
      src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs
  22. 4
      src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs
  23. 4
      src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Primitives.cs
  24. 28
      src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs
  25. 6
      src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
  26. 8
      src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs
  27. 6
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs
  28. 1084
      src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
  29. 20
      src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt
  30. 130
      src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
  31. 20
      src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt
  32. 6
      src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs
  33. 6
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs
  34. 6
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs
  35. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs
  36. 6
      src/ImageSharp/Primitives/Rational.cs
  37. 6
      src/ImageSharp/Primitives/SignedRational.cs
  38. 6
      src/ImageSharp/Processing/Extensions/ProcessingExtensions.cs
  39. 10
      src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs
  40. 8
      src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs
  41. 6
      src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs
  42. 4
      tests/ImageSharp.Benchmarks/Codecs/Jpeg/DoubleBufferedStreams.cs
  43. 8
      tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.cs
  44. 32
      tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs
  45. 8
      tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs
  46. 6
      tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs
  47. 8
      tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs
  48. 4
      tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs
  49. 4
      tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs
  50. 10
      tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs
  51. 36
      tests/ImageSharp.Tests/Color/ColorTests.CastFrom.cs
  52. 48
      tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs
  53. 48
      tests/ImageSharp.Tests/Color/ColorTests.ConstructFrom.cs
  54. 24
      tests/ImageSharp.Tests/Color/ColorTests.cs
  55. 2
      tests/ImageSharp.Tests/Colorspaces/RgbTests.cs
  56. 22
      tests/ImageSharp.Tests/Common/SimdUtilsTests.cs
  57. 10
      tests/ImageSharp.Tests/Drawing/DrawImageTests.cs
  58. 8
      tests/ImageSharp.Tests/Drawing/DrawPathTests.cs
  59. 40
      tests/ImageSharp.Tests/Drawing/FillPolygonTests.cs
  60. 4
      tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs
  61. 12
      tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs
  62. 6
      tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs
  63. 20
      tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs
  64. 22
      tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs
  65. 14
      tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs
  66. 2
      tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs
  67. 2
      tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs
  68. 16
      tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs
  69. 6
      tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs
  70. 6
      tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs
  71. 2
      tests/ImageSharp.Tests/Formats/Jpg/ZigZagTests.cs
  72. 6
      tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs
  73. 4
      tests/ImageSharp.Tests/Helpers/ParallelHelperTests.cs
  74. 28
      tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs
  75. 8
      tests/ImageSharp.Tests/IO/DoubleBufferedStreamReaderTests.cs
  76. 6
      tests/ImageSharp.Tests/Image/ImageCloneTests.cs
  77. 18
      tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs
  78. 8
      tests/ImageSharp.Tests/Image/ImageSaveTests.cs
  79. 20
      tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs
  80. 22
      tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_PassLocalConfiguration.cs
  81. 2
      tests/ImageSharp.Tests/Image/ImageTests.Save.cs
  82. 4
      tests/ImageSharp.Tests/ImageOperationTests.cs
  83. 12
      tests/ImageSharp.Tests/Memory/Buffer2DTests.cs
  84. 6
      tests/ImageSharp.Tests/Memory/BufferAreaTests.cs
  85. 2
      tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs
  86. 6
      tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccWriterTests.cs
  87. 22
      tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs
  88. 88
      tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs
  89. 4
      tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs
  90. 6
      tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs
  91. 6
      tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs
  92. 6
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.cs
  93. 4
      tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs
  94. 2
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
  95. 12
      tests/ImageSharp.Tests/TestUtilities/TestDataGenerator.cs

2
README.md

@ -92,7 +92,7 @@ using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
// Individual pixels
using (Image<Rgba32> image = new Image<Rgba32>(400, 400))
using (var image = new Image<Rgba32>(400, 400))
{
image[200, 200] = Rgba32.White;
}

4
src/ImageSharp.Drawing/Processing/DrawingHelpers.cs

@ -14,9 +14,9 @@ namespace SixLabors.ImageSharp.Processing
public static DenseMatrix<TPixel> ToPixelMatrix<TPixel>(this DenseMatrix<Color> colorMatrix, Configuration configuration)
where TPixel : struct, IPixel<TPixel>
{
DenseMatrix<TPixel> result = new DenseMatrix<TPixel>(colorMatrix.Columns, colorMatrix.Rows);
var result = new DenseMatrix<TPixel>(colorMatrix.Columns, colorMatrix.Rows);
Color.ToPixel(configuration, colorMatrix.Span, result.Span);
return result;
}
}
}
}

4
src/ImageSharp/Common/Extensions/StreamExtensions.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;
@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp
}
else
{
byte[] foo = new byte[count];
var foo = new byte[count];
while (count > 0)
{
int bytesRead = stream.Read(foo, 0, count);

12
src/ImageSharp/Common/Helpers/SimdUtils.BasicIntrinsics256.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;
@ -138,8 +138,8 @@ namespace SixLabors.ImageSharp
ref Octet.OfByte destBase = ref Unsafe.As<byte, Octet.OfByte>(ref MemoryMarshal.GetReference(dest));
int n = source.Length / 8;
Vector<float> magick = new Vector<float>(32768.0f);
Vector<float> scale = new Vector<float>(255f) / new Vector<float>(256f);
var magick = new Vector<float>(32768.0f);
var scale = new Vector<float>(255f) / new Vector<float>(256f);
// need to copy to a temporary struct, because
// SimdUtils.Octet.OfUInt32 temp = Unsafe.As<Vector<float>, SimdUtils.Octet.OfUInt32>(ref x)
@ -187,8 +187,8 @@ namespace SixLabors.ImageSharp
ref Octet.OfByte destBase = ref Unsafe.As<byte, Octet.OfByte>(ref MemoryMarshal.GetReference(dest));
int n = source.Length / 8;
Vector<float> magick = new Vector<float>(32768.0f);
Vector<float> scale = new Vector<float>(255f) / new Vector<float>(256f);
var magick = new Vector<float>(32768.0f);
var scale = new Vector<float>(255f) / new Vector<float>(256f);
// need to copy to a temporary struct, because
// SimdUtils.Octet.OfUInt32 temp = Unsafe.As<Vector<float>, SimdUtils.Octet.OfUInt32>(ref x)
@ -211,4 +211,4 @@ namespace SixLabors.ImageSharp
}
}
}
}
}

6
src/ImageSharp/Common/Helpers/SimdUtils.ExtendedIntrinsics.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;
@ -172,7 +172,7 @@ namespace SixLabors.ImageSharp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Vector<uint> ConvertToUInt32(Vector<float> vf)
{
Vector<float> maxBytes = new Vector<float>(255f);
var maxBytes = new Vector<float>(255f);
vf *= maxBytes;
vf += new Vector<float>(0.5f);
vf = Vector.Min(Vector.Max(vf, Vector<float>.Zero), maxBytes);
@ -190,4 +190,4 @@ namespace SixLabors.ImageSharp
}
}
}
}
}

6
src/ImageSharp/Common/Helpers/SimdUtils.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;
@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Vector<float> FastRound(this Vector<float> v)
{
Vector<int> magic0 = new Vector<int>(int.MinValue); // 0x80000000
var magic0 = new Vector<int>(int.MinValue); // 0x80000000
Vector<float> sgn0 = Vector.AsVectorSingle(magic0);
Vector<float> and0 = Vector.BitwiseAnd(sgn0, v);
Vector<float> or0 = Vector.BitwiseOr(and0, new Vector<float>(8388608.0f));
@ -179,4 +179,4 @@ namespace SixLabors.ImageSharp
$"length should be divisible by {shouldBeDivisibleBy}!");
}
}
}
}

20
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -446,7 +446,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
#if NETCOREAPP2_1
Span<byte> cmd = stackalloc byte[2];
#else
byte[] cmd = new byte[2];
var cmd = new byte[2];
#endif
int count = 0;
@ -485,7 +485,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
int max = cmd[1];
int bytesToRead = (max + 1) / 2;
byte[] run = new byte[bytesToRead];
var run = new byte[bytesToRead];
this.stream.Read(run, 0, run.Length);
@ -557,7 +557,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
#if NETCOREAPP2_1
Span<byte> cmd = stackalloc byte[2];
#else
byte[] cmd = new byte[2];
var cmd = new byte[2];
#endif
int count = 0;
@ -595,7 +595,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
// Take this number of bytes from the stream as uncompressed data.
int length = cmd[1];
byte[] run = new byte[length];
var run = new byte[length];
this.stream.Read(run, 0, run.Length);
@ -640,7 +640,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
#if NETCOREAPP2_1
Span<byte> cmd = stackalloc byte[2];
#else
byte[] cmd = new byte[2];
var cmd = new byte[2];
#endif
int uncompressedPixels = 0;
@ -678,7 +678,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
// Take this number of bytes from the stream as uncompressed data.
int length = cmd[1];
byte[] run = new byte[length * 3];
var run = new byte[length * 3];
this.stream.Read(run, 0, run.Length);
@ -1214,7 +1214,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
#if NETCOREAPP2_1
Span<byte> buffer = stackalloc byte[BmpInfoHeader.MaxHeaderSize];
#else
byte[] buffer = new byte[BmpInfoHeader.MaxHeaderSize];
var buffer = new byte[BmpInfoHeader.MaxHeaderSize];
#endif
// Read the header size.
@ -1252,7 +1252,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
// color masks for each color channel follow the info header.
if (this.infoHeader.Compression == BmpCompression.BitFields)
{
byte[] bitfieldsBuffer = new byte[12];
var bitfieldsBuffer = new byte[12];
this.stream.Read(bitfieldsBuffer, 0, 12);
Span<byte> data = bitfieldsBuffer.AsSpan();
this.infoHeader.RedMask = BinaryPrimitives.ReadInt32LittleEndian(data.Slice(0, 4));
@ -1261,7 +1261,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
}
else if (this.infoHeader.Compression == BmpCompression.BI_ALPHABITFIELDS)
{
byte[] bitfieldsBuffer = new byte[16];
var bitfieldsBuffer = new byte[16];
this.stream.Read(bitfieldsBuffer, 0, 16);
Span<byte> data = bitfieldsBuffer.AsSpan();
this.infoHeader.RedMask = BinaryPrimitives.ReadInt32LittleEndian(data.Slice(0, 4));
@ -1340,7 +1340,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
#if NETCOREAPP2_1
Span<byte> buffer = stackalloc byte[BmpFileHeader.Size];
#else
byte[] buffer = new byte[BmpFileHeader.Size];
var buffer = new byte[BmpFileHeader.Size];
#endif
this.stream.Read(buffer, 0, BmpFileHeader.Size);

4
src/ImageSharp/Formats/Bmp/BmpEncoderCore.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;
@ -176,7 +176,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
#if NETCOREAPP2_1
Span<byte> buffer = stackalloc byte[infoHeaderSize];
#else
byte[] buffer = new byte[infoHeaderSize];
var buffer = new byte[infoHeaderSize];
#endif
fileHeader.WriteTo(buffer);

6
src/ImageSharp/Formats/Gif/LzwDecoder.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;
@ -116,7 +116,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
#if NETCOREAPP2_1
Span<byte> buffer = stackalloc byte[255];
#else
byte[] buffer = new byte[255];
var buffer = new byte[255];
#endif
while (xyz < length)
@ -253,4 +253,4 @@ namespace SixLabors.ImageSharp.Formats.Gif
this.pixelStack.Dispose();
}
}
}
}

4
src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs

@ -194,7 +194,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
/// </summary>
public short[] ToArray()
{
short[] result = new short[Size];
var result = new short[Size];
this.CopyTo(result);
return result;
}
@ -297,4 +297,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
return result;
}
}
}
}

12
src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.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;
@ -95,9 +95,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
/// </summary>
public void NormalizeColorsInplace(float maximum)
{
Vector4 CMin4 = new Vector4(0F);
Vector4 CMax4 = new Vector4(maximum);
Vector4 COff4 = new Vector4(MathF.Ceiling(maximum / 2));
var CMin4 = new Vector4(0F);
var CMax4 = new Vector4(maximum);
var COff4 = new Vector4(MathF.Ceiling(maximum / 2));
this.V0L = Vector4.Clamp(this.V0L + COff4, CMin4, CMax4);
this.V0R = Vector4.Clamp(this.V0R + COff4, CMin4, CMax4);
@ -123,8 +123,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
[MethodImpl(InliningOptions.ShortMethod)]
public void NormalizeColorsAndRoundInplaceAvx2(float maximum)
{
Vector<float> off = new Vector<float>(MathF.Ceiling(maximum / 2));
Vector<float> max = new Vector<float>(maximum);
var off = new Vector<float>(MathF.Ceiling(maximum / 2));
var max = new Vector<float>(maximum);
ref Vector<float> row0 = ref Unsafe.As<Vector4, Vector<float>>(ref this.V0L);
row0 = NormalizeAndRound(row0, off, max);

20
src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt

@ -1,4 +1,4 @@
<#
<#
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
#>
@ -47,7 +47,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
char srcCoord = coordz[j % 4];
char srcSide = (j / 4) % 2 == 0 ? 'L' : 'R';
string expression = $"d.V{j}{destSide}.{destCoord} = V{i}{srcSide}.{srcCoord};\r\n";
var expression = $"d.V{j}{destSide}.{destCoord} = V{i}{srcSide}.{srcCoord};\r\n";
Write(expression);
}
}
@ -60,9 +60,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
/// </summary>
public void NormalizeColorsInplace(float maximum)
{
Vector4 CMin4 = new Vector4(0F);
Vector4 CMax4 = new Vector4(maximum);
Vector4 COff4 = new Vector4(MathF.Ceiling(maximum / 2));
var CMin4 = new Vector4(0F);
var CMax4 = new Vector4(maximum);
var COff4 = new Vector4(MathF.Ceiling(maximum / 2));
<#
@ -86,8 +86,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
[MethodImpl(InliningOptions.ShortMethod)]
public void NormalizeColorsAndRoundInplaceAvx2(float maximum)
{
Vector<float> off = new Vector<float>(MathF.Ceiling(maximum / 2));
Vector<float> max = new Vector<float>(maximum);
var off = new Vector<float>(MathF.Ceiling(maximum / 2));
var max = new Vector<float>(maximum);
<#
for (int i = 0; i < 8; i++)
@ -117,7 +117,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
{
char destCoord = coordz[i % 4];
char destSide = (i / 4) % 2 == 0 ? 'L' : 'R';
if(j > 0 && i == 0){
WriteLine("");
}
@ -125,9 +125,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
char srcCoord = coordz[j % 4];
char srcSide = (j / 4) % 2 == 0 ? 'L' : 'R';
string expression = $"this.V{j}{destSide}.{destCoord} = Unsafe.Add(ref selfRef, {j*8+i});\r\n";
var expression = $"this.V{j}{destSide}.{destCoord} = Unsafe.Add(ref selfRef, {j*8+i});\r\n";
Write(expression);
}
}
PopIndent();

6
src/ImageSharp/Formats/Jpeg/Components/Block8x8F.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;
@ -257,7 +257,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
{
fixed (Vector4* ptr = &this.V0L)
{
float* fp = (float*)ptr;
var fp = (float*)ptr;
for (int i = 0; i < Size; i++)
{
dest[i] = (int)fp[i];
@ -267,7 +267,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
public float[] ToArray()
{
float[] result = new float[Size];
var result = new float[Size];
this.CopyTo(result);
return result;
}

6
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -538,7 +538,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
return;
}
byte[] profile = new byte[remaining];
var profile = new byte[remaining];
this.InputStream.Read(profile, 0, remaining);
if (ProfileResolver.IsProfile(profile, ProfileResolver.ExifMarker))
@ -571,14 +571,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
return;
}
byte[] identifier = new byte[Icclength];
var identifier = new byte[Icclength];
this.InputStream.Read(identifier, 0, Icclength);
remaining -= Icclength; // We have read it by this point
if (ProfileResolver.IsProfile(identifier, ProfileResolver.IccMarker))
{
this.isIcc = true;
byte[] profile = new byte[remaining];
var profile = new byte[remaining];
this.InputStream.Read(profile, 0, remaining);
if (this.iccData is null)

6
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -183,12 +183,12 @@ namespace SixLabors.ImageSharp.Formats.Png
break;
case PngChunkType.Palette:
byte[] pal = new byte[chunk.Length];
var pal = new byte[chunk.Length];
Buffer.BlockCopy(chunk.Data.Array, 0, pal, 0, chunk.Length);
this.palette = pal;
break;
case PngChunkType.Transparency:
byte[] alpha = new byte[chunk.Length];
var alpha = new byte[chunk.Length];
Buffer.BlockCopy(chunk.Data.Array, 0, alpha, 0, chunk.Length);
this.paletteAlpha = alpha;
this.AssignTransparentMarkers(alpha, pngMetadata);
@ -205,7 +205,7 @@ namespace SixLabors.ImageSharp.Formats.Png
case PngChunkType.Exif:
if (!this.ignoreMetadata)
{
byte[] exifData = new byte[chunk.Length];
var exifData = new byte[chunk.Length];
Buffer.BlockCopy(chunk.Data.Array, 0, exifData, 0, chunk.Length);
metadata.ExifProfile = new ExifProfile(exifData);
}

2
src/ImageSharp/ImageFrameCollection{TPixel}.cs

@ -347,7 +347,7 @@ namespace SixLabors.ImageSharp
private ImageFrame<TPixel> CopyNonCompatibleFrame(ImageFrame source)
{
ImageFrame<TPixel> result = new ImageFrame<TPixel>(
var result = new ImageFrame<TPixel>(
this.parent.GetConfiguration(),
source.Size(),
source.Metadata.DeepClone());

2
src/ImageSharp/MetaData/Profiles/Exif/ExifWriter.cs

@ -87,7 +87,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
length += 4 + 2;
byte[] result = new byte[length];
var result = new byte[length];
int i = 0;

14
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Curves.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;
@ -18,13 +18,13 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
ushort segmentCount = this.ReadUInt16();
this.AddIndex(2); // 2 bytes reserved
float[] breakPoints = new float[segmentCount - 1];
var breakPoints = new float[segmentCount - 1];
for (int i = 0; i < breakPoints.Length; i++)
{
breakPoints[i] = this.ReadSingle();
}
IccCurveSegment[] segments = new IccCurveSegment[segmentCount];
var segments = new IccCurveSegment[segmentCount];
for (int i = 0; i < segmentCount; i++)
{
segments[i] = this.ReadCurveSegment();
@ -41,19 +41,19 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccResponseCurve ReadResponseCurve(int channelCount)
{
var type = (IccCurveMeasurementEncodings)this.ReadUInt32();
uint[] measurement = new uint[channelCount];
var measurement = new uint[channelCount];
for (int i = 0; i < channelCount; i++)
{
measurement[i] = this.ReadUInt32();
}
Vector3[] xyzValues = new Vector3[channelCount];
var xyzValues = new Vector3[channelCount];
for (int i = 0; i < channelCount; i++)
{
xyzValues[i] = this.ReadXyzNumber();
}
IccResponseNumber[][] response = new IccResponseNumber[channelCount][];
var response = new IccResponseNumber[channelCount][];
for (int i = 0; i < channelCount; i++)
{
response[i] = new IccResponseNumber[measurement[i]];
@ -175,7 +175,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccSampledCurveElement ReadSampledCurveElement()
{
uint count = this.ReadUInt32();
float[] entries = new float[count];
var entries = new float[count];
for (int i = 0; i < count; i++)
{
entries[i] = this.ReadSingle();

14
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Lut.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;
@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
/// <returns>The read LUT</returns>
public IccLut ReadLut16(int count)
{
ushort[] values = new ushort[count];
var values = new ushort[count];
for (int i = 0; i < count; i++)
{
values[i] = this.ReadUInt16();
@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccClut ReadClut(int inChannelCount, int outChannelCount, bool isFloat)
{
// Grid-points are always 16 bytes long but only 0-inChCount are used
byte[] gridPointCount = new byte[inChannelCount];
var gridPointCount = new byte[inChannelCount];
Buffer.BlockCopy(this.data, this.AddIndex(16), gridPointCount, 0, inChannelCount);
if (!isFloat)
@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
const float Max = byte.MaxValue;
float[][] values = new float[length][];
var values = new float[length][];
for (int i = 0; i < length; i++)
{
values[i] = new float[outChannelCount];
@ -122,7 +122,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
const float Max = ushort.MaxValue;
float[][] values = new float[length][];
var values = new float[length][];
for (int i = 0; i < length; i++)
{
values[i] = new float[outChannelCount];
@ -154,7 +154,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
length /= inChCount;
float[][] values = new float[length][];
var values = new float[length][];
for (int i = 0; i < length; i++)
{
values[i] = new float[outChCount];
@ -168,4 +168,4 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
return new IccClut(values, gridPointCount, IccClutDataType.Float);
}
}
}
}

6
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Matrix.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.
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
/// <returns>The read matrix</returns>
public float[,] ReadMatrix(int xCount, int yCount, bool isSingle)
{
float[,] matrix = new float[xCount, yCount];
var matrix = new float[xCount, yCount];
for (int y = 0; y < yCount; y++)
{
for (int x = 0; x < xCount; x++)
@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
/// <returns>The read matrix</returns>
public float[] ReadMatrix(int yCount, bool isSingle)
{
float[] matrix = new float[yCount];
var matrix = new float[yCount];
for (int i = 0; i < yCount; i++)
{
if (isSingle)

4
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.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.
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
/// <returns>The read <see cref="IccCurveSetProcessElement"/></returns>
public IccCurveSetProcessElement ReadCurveSetProcessElement(int inChannelCount, int outChannelCount)
{
IccOneDimensionalCurve[] curves = new IccOneDimensionalCurve[inChannelCount];
var curves = new IccOneDimensionalCurve[inChannelCount];
for (int i = 0; i < inChannelCount; i++)
{
curves[i] = this.ReadOneDimensionalCurve();

4
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.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;
@ -105,7 +105,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
string name = this.ReadAsciiString(32);
ushort[] pcsCoord = { this.ReadUInt16(), this.ReadUInt16(), this.ReadUInt16() };
ushort[] deviceCoord = new ushort[deviceCoordCount];
var deviceCoord = new ushort[deviceCoordCount];
for (int i = 0; i < deviceCoordCount; i++)
{

4
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Primitives.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;
@ -165,7 +165,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
/// <returns>The read bytes</returns>
public byte[] ReadBytes(int count)
{
byte[] bytes = new byte[count];
var bytes = new byte[count];
Buffer.BlockCopy(this.data, this.AddIndex(count), bytes, 0, count);
return bytes;
}

28
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs

@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
else
{
// The type is not know, so the values need be read
double[][] values = new double[channelCount][];
var values = new double[channelCount][];
for (int i = 0; i < channelCount; i++)
{
values[i] = new double[] { this.ReadUFix16(), this.ReadUFix16() };
@ -208,7 +208,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
return new IccCurveTagDataEntry(this.ReadUFix8());
}
float[] cdata = new float[pointCount];
var cdata = new float[pointCount];
for (int i = 0; i < pointCount; i++)
{
cdata[i] = this.ReadUInt16() / 65535f;
@ -264,7 +264,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
// Input LUT
var inValues = new IccLut[inChCount];
byte[] gridPointCount = new byte[inChCount];
var gridPointCount = new byte[inChCount];
for (int i = 0; i < inChCount; i++)
{
inValues[i] = this.ReadLut16(inTableCount);
@ -299,7 +299,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
// Input LUT
var inValues = new IccLut[inChCount];
byte[] gridPointCount = new byte[inChCount];
var gridPointCount = new byte[inChCount];
for (int i = 0; i < inChCount; i++)
{
inValues[i] = this.ReadLut8();
@ -464,8 +464,8 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
var text = new IccLocalizedString[recordCount];
var culture = new CultureInfo[recordCount];
uint[] length = new uint[recordCount];
uint[] offset = new uint[recordCount];
var length = new uint[recordCount];
var offset = new uint[recordCount];
for (int i = 0; i < recordCount; i++)
{
@ -627,7 +627,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
ushort channelCount = this.ReadUInt16();
ushort measurementCount = this.ReadUInt16();
uint[] offset = new uint[measurementCount];
var offset = new uint[measurementCount];
for (int i = 0; i < measurementCount; i++)
{
offset[i] = this.ReadUInt32();
@ -651,7 +651,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccFix16ArrayTagDataEntry ReadFix16ArrayTagDataEntry(uint size)
{
uint count = (size - 8) / 4;
float[] arrayData = new float[count];
var arrayData = new float[count];
for (int i = 0; i < count; i++)
{
arrayData[i] = this.ReadFix16() / 256f;
@ -687,7 +687,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccUFix16ArrayTagDataEntry ReadUFix16ArrayTagDataEntry(uint size)
{
uint count = (size - 8) / 4;
float[] arrayData = new float[count];
var arrayData = new float[count];
for (int i = 0; i < count; i++)
{
arrayData[i] = this.ReadUFix16();
@ -704,7 +704,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccUInt16ArrayTagDataEntry ReadUInt16ArrayTagDataEntry(uint size)
{
uint count = (size - 8) / 2;
ushort[] arrayData = new ushort[count];
var arrayData = new ushort[count];
for (int i = 0; i < count; i++)
{
arrayData[i] = this.ReadUInt16();
@ -721,7 +721,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccUInt32ArrayTagDataEntry ReadUInt32ArrayTagDataEntry(uint size)
{
uint count = (size - 8) / 4;
uint[] arrayData = new uint[count];
var arrayData = new uint[count];
for (int i = 0; i < count; i++)
{
arrayData[i] = this.ReadUInt32();
@ -738,7 +738,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccUInt64ArrayTagDataEntry ReadUInt64ArrayTagDataEntry(uint size)
{
uint count = (size - 8) / 8;
ulong[] arrayData = new ulong[count];
var arrayData = new ulong[count];
for (int i = 0; i < count; i++)
{
arrayData[i] = this.ReadUInt64();
@ -878,14 +878,14 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
public IccUcrBgTagDataEntry ReadUcrBgTagDataEntry(uint size)
{
uint ucrCount = this.ReadUInt32();
ushort[] ucrCurve = new ushort[ucrCount];
var ucrCurve = new ushort[ucrCount];
for (int i = 0; i < ucrCurve.Length; i++)
{
ucrCurve[i] = this.ReadUInt16();
}
uint bgCount = this.ReadUInt32();
ushort[] bgCurve = new ushort[bgCount];
var bgCurve = new ushort[bgCount];
for (int i = 0; i < bgCurve.Length; i++)
{
bgCurve[i] = this.ReadUInt16();

6
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs

@ -560,8 +560,8 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
// TODO: Investigate cost of Linq GroupBy
IGrouping<string, IccLocalizedString>[] texts = value.Texts.GroupBy(t => t.Text).ToArray();
uint[] offset = new uint[texts.Length];
int[] lengths = new int[texts.Length];
var offset = new uint[texts.Length];
var lengths = new int[texts.Length];
for (int i = 0; i < texts.Length; i++)
{
@ -746,7 +746,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
long tablePosition = this.dataStream.Position;
this.dataStream.Position += value.Curves.Length * 4;
uint[] offset = new uint[value.Curves.Length];
var offset = new uint[value.Curves.Length];
for (int i = 0; i < value.Curves.Length; i++)
{

8
src/ImageSharp/MetaData/Profiles/ICC/IccProfile.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;
@ -108,7 +108,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
const int profileIdPos = 84;
// need to copy some values because they need to be zero for the hashing
byte[] temp = new byte[24];
var temp = new byte[24];
Buffer.BlockCopy(data, profileFlagPos, temp, 0, 4);
Buffer.BlockCopy(data, renderingIntentPos, temp, 4, 4);
Buffer.BlockCopy(data, profileIdPos, temp, 8, 16);
@ -171,7 +171,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
if (this.data != null)
{
byte[] copy = new byte[this.data.Length];
var copy = new byte[this.data.Length];
Buffer.BlockCopy(this.data, 0, copy, 0, copy.Length);
return copy;
}
@ -216,4 +216,4 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
this.entries = reader.ReadTagData(this.data);
}
}
}
}

6
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.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;
@ -122,7 +122,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
&& p3 >= 0x41 && p3 <= 0x5A
&& p4 >= 0x41 && p4 <= 0x5A)
{
string culture = new string(new[] { (char)p1, (char)p2, '-', (char)p3, (char)p4 });
var culture = new string(new[] { (char)p1, (char)p2, '-', (char)p3, (char)p4 });
return new CultureInfo(culture);
}
@ -175,4 +175,4 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
this.ScriptCodeCode);
}
}
}
}

1084
src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs

File diff suppressed because it is too large

20
src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt

@ -1,4 +1,4 @@
<#
<#
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
#>
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
<#
string[] composers = new []{
var composers = new []{
"Src",
"SrcAtop",
"SrcOver",
@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
"Xor",
};
string[] blenders = new []{
var blenders = new []{
"Normal",
"Multiply",
"Add",
@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
foreach(var composer in composers) {
foreach(var blender in blenders) {
string blender_composer= $"{blender}{composer}";
var blender_composer= $"{blender}{composer}";
#>
internal class <#= blender_composer#> : PixelBlender<TPixel>
@ -82,26 +82,26 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
TPixel dest = default;
dest.FromScaledVector4(PorterDuffFunctions.<#=blender_composer#>(background.ToScaledVector4(), source.ToScaledVector4(), amount.Clamp(0, 1)));
return dest;
return dest;
}
/// <inheritdoc />
protected override void BlendFunction(Span<Vector4> destination, ReadOnlySpan<Vector4> background, ReadOnlySpan<Vector4> source, float amount)
protected override void BlendFunction(Span<Vector4> destination, ReadOnlySpan<Vector4> background, ReadOnlySpan<Vector4> source, float amount)
{
amount = amount.Clamp(0, 1);
for (int i = 0; i < destination.Length; i++)
{
destination[i] = PorterDuffFunctions.<#=blender_composer#>(background[i], source[i], amount);
}
}
}
/// <inheritdoc />
protected override void BlendFunction(Span<Vector4> destination, ReadOnlySpan<Vector4> background, ReadOnlySpan<Vector4> source, ReadOnlySpan<float> amount)
protected override void BlendFunction(Span<Vector4> destination, ReadOnlySpan<Vector4> background, ReadOnlySpan<Vector4> source, ReadOnlySpan<float> amount)
{
for (int i = 0; i < destination.Length; i++)
{
destination[i] = PorterDuffFunctions.<#=blender_composer#>(background[i], source[i], amount[i].Clamp(0, 1));
}
}
}
}
@ -111,4 +111,4 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
#>
}
}
}

130
src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.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.
// <auto-generated />
@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 NormalClear(Vector4 backdrop, Vector4 source, float opacity)
@ -110,7 +110,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalSrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -122,7 +121,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalSrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -134,7 +132,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalSrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -146,7 +143,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalSrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -158,7 +154,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalSrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -170,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -182,7 +176,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -194,7 +187,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -206,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -218,7 +209,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -230,7 +220,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -242,7 +231,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel NormalXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -339,7 +327,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 MultiplyClear(Vector4 backdrop, Vector4 source, float opacity)
@ -348,7 +336,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplySrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -360,7 +347,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplySrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -372,7 +358,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplySrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -384,7 +369,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplySrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -396,7 +380,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplySrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -408,7 +391,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplyDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -420,7 +402,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplyDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -432,7 +413,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplyDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -444,7 +424,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplyDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -456,7 +435,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplyDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -468,7 +446,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplyClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -480,7 +457,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel MultiplyXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -577,7 +553,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 AddClear(Vector4 backdrop, Vector4 source, float opacity)
@ -586,7 +562,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddSrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -598,7 +573,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddSrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -610,7 +584,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddSrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -622,7 +595,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddSrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -634,7 +606,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddSrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -646,7 +617,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -658,7 +628,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -670,7 +639,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -682,7 +650,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -694,7 +661,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -706,7 +672,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -718,7 +683,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel AddXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -815,7 +779,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 SubtractClear(Vector4 backdrop, Vector4 source, float opacity)
@ -824,7 +788,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractSrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -836,7 +799,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractSrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -848,7 +810,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractSrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -860,7 +821,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractSrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -872,7 +832,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractSrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -884,7 +843,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -896,7 +854,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -908,7 +865,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -920,7 +876,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -932,7 +887,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -944,7 +898,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -956,7 +909,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel SubtractXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1053,7 +1005,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 ScreenClear(Vector4 backdrop, Vector4 source, float opacity)
@ -1062,7 +1014,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenSrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1074,7 +1025,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenSrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1086,7 +1036,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenSrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1098,7 +1047,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenSrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1110,7 +1058,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenSrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1122,7 +1069,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1134,7 +1080,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1146,7 +1091,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1158,7 +1102,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1170,7 +1113,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1182,7 +1124,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1194,7 +1135,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel ScreenXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1291,7 +1231,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 DarkenClear(Vector4 backdrop, Vector4 source, float opacity)
@ -1300,7 +1240,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenSrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1312,7 +1251,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenSrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1324,7 +1262,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenSrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1336,7 +1273,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenSrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1348,7 +1284,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenSrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1360,7 +1295,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1372,7 +1306,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1384,7 +1317,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1396,7 +1328,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1408,7 +1339,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1420,7 +1350,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1432,7 +1361,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel DarkenXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1529,7 +1457,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 LightenClear(Vector4 backdrop, Vector4 source, float opacity)
@ -1538,7 +1466,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenSrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1550,7 +1477,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenSrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1562,7 +1488,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenSrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1574,7 +1499,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenSrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1586,7 +1510,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenSrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1598,7 +1521,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1610,7 +1532,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1622,7 +1543,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1634,7 +1554,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1646,7 +1565,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1658,7 +1576,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1670,7 +1587,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel LightenXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1767,7 +1683,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 OverlayClear(Vector4 backdrop, Vector4 source, float opacity)
@ -1776,7 +1692,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlaySrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1788,7 +1703,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlaySrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1800,7 +1714,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlaySrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1812,7 +1725,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlaySrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1824,7 +1736,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlaySrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1836,7 +1747,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlayDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1848,7 +1758,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlayDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1860,7 +1769,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlayDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1872,7 +1780,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlayDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1884,7 +1791,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlayDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1896,7 +1802,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlayClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -1908,7 +1813,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel OverlayXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2005,7 +1909,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 HardLightClear(Vector4 backdrop, Vector4 source, float opacity)
@ -2014,7 +1918,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return Clear(backdrop, source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightSrc<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2026,7 +1929,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightSrcAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2038,7 +1940,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightSrcOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2050,7 +1951,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightSrcIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2062,7 +1962,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightSrcOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2074,7 +1973,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightDest<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2086,7 +1984,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightDestAtop<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2098,7 +1995,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightDestOver<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2110,7 +2006,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightDestIn<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2122,7 +2017,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightDestOut<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2134,7 +2028,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightClear<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2146,7 +2039,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel HardLightXor<TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -2159,4 +2051,4 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
}
}

20
src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt

@ -1,4 +1,4 @@
<#
<#
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
#>
@ -113,7 +113,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
source.W *= opacity;
return Xor(backdrop, source);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static Vector4 <#=blender#>Clear(Vector4 backdrop, Vector4 source, float opacity)
@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
<# } #>
<# void GenerateGenericPixelBlender(string blender, string composer) { #>
<# void GenerateGenericPixelBlender(string blender, string composer) { #>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TPixel <#=blender#><#=composer#><TPixel>(TPixel backdrop, TPixel source, float opacity)
@ -141,7 +141,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
<#
string[] composers = new []{
var composers = new []{
"Src",
"SrcAtop",
"SrcOver",
@ -156,7 +156,7 @@ string[] composers = new []{
"Xor",
};
string[] blenders = new []{
var blenders = new []{
"Normal",
"Multiply",
"Add",
@ -166,12 +166,12 @@ string[] blenders = new []{
"Lighten",
"Overlay",
"HardLight"
};
};
foreach(var blender in blenders)
{
GeneratePixelBlenders(blender);
{
GeneratePixelBlenders(blender);
foreach(var composer in composers)
{
GenerateGenericPixelBlender(blender,composer);
@ -180,4 +180,4 @@ string[] blenders = new []{
#>
}
}
}

6
src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.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;
@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public void FromScaledVector4(Vector4 vector)
{
Vector2 scaled = new Vector2(vector.X, vector.Y) * 2F;
var scaled = new Vector2(vector.X, vector.Y) * 2F;
scaled -= Vector2.One;
this.PackedValue = Pack(scaled.X, scaled.Y);
}
@ -173,4 +173,4 @@ namespace SixLabors.ImageSharp.PixelFormats
return num2 | num;
}
}
}
}

6
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.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;
@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public void FromScaledVector4(Vector4 vector)
{
Vector2 scaled = new Vector2(vector.X, vector.Y) * 2F;
var scaled = new Vector2(vector.X, vector.Y) * 2F;
scaled -= Vector2.One;
this.PackedValue = Pack(scaled);
}
@ -179,4 +179,4 @@ namespace SixLabors.ImageSharp.PixelFormats
return (ushort)(byte2 | byte1);
}
}
}
}

6
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.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;
@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public void FromScaledVector4(Vector4 vector)
{
Vector2 scaled = new Vector2(vector.X, vector.Y) * 2F;
var scaled = new Vector2(vector.X, vector.Y) * 2F;
scaled -= Vector2.One;
this.PackedValue = Pack(scaled);
}
@ -186,4 +186,4 @@ namespace SixLabors.ImageSharp.PixelFormats
return word2 | word1;
}
}
}
}

6
src/ImageSharp/PixelFormats/PixelImplementations/Short2.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;
@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public void FromScaledVector4(Vector4 vector)
{
Vector2 scaled = new Vector2(vector.X, vector.Y) * 65534F;
var scaled = new Vector2(vector.X, vector.Y) * 65534F;
scaled -= new Vector2(32767F);
this.PackedValue = Pack(scaled);
}
@ -179,4 +179,4 @@ namespace SixLabors.ImageSharp.PixelFormats
return word2 | word1;
}
}
}
}

6
src/ImageSharp/Primitives/Rational.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;
@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Primitives
{
if (simplify)
{
LongRational rational = new LongRational(numerator, denominator).Simplify();
var rational = new LongRational(numerator, denominator).Simplify();
this.Numerator = (uint)rational.Numerator;
this.Denominator = (uint)rational.Denominator;
@ -187,4 +187,4 @@ namespace SixLabors.ImageSharp.Primitives
return rational.ToString(provider);
}
}
}
}

6
src/ImageSharp/Primitives/SignedRational.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;
@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Primitives
{
if (simplify)
{
LongRational rational = new LongRational(numerator, denominator).Simplify();
var rational = new LongRational(numerator, denominator).Simplify();
this.Numerator = (int)rational.Numerator;
this.Denominator = (int)rational.Denominator;
@ -187,4 +187,4 @@ namespace SixLabors.ImageSharp.Primitives
return rational.ToString(provider);
}
}
}
}

6
src/ImageSharp/Processing/Extensions/ProcessingExtensions.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.Processing
Guard.NotNull(operation, nameof(operation));
source.EnsureNotDisposed();
ProcessingVisitor visitor = new ProcessingVisitor(operation, true);
var visitor = new ProcessingVisitor(operation, true);
source.AcceptVisitor(visitor);
}
@ -77,7 +77,7 @@ namespace SixLabors.ImageSharp.Processing
Guard.NotNull(operation, nameof(operation));
source.EnsureNotDisposed();
ProcessingVisitor visitor = new ProcessingVisitor(operation, false);
var visitor = new ProcessingVisitor(operation, false);
source.AcceptVisitor(visitor);
return visitor.ResultImage;
}

10
src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs

@ -69,10 +69,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Effects
int maxIntensity = 0;
int maxIndex = 0;
int[] intensityBin = new int[levels];
float[] redBin = new float[levels];
float[] blueBin = new float[levels];
float[] greenBin = new float[levels];
var intensityBin = new int[levels];
var redBin = new float[levels];
var blueBin = new float[levels];
var greenBin = new float[levels];
for (int fy = 0; fy <= radius; fy++)
{
@ -126,4 +126,4 @@ namespace SixLabors.ImageSharp.Processing.Processors.Effects
}
}
}
}
}

8
src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.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;
@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
public IFrameQuantizer<TPixel> CreateFrameQuantizer<TPixel>(Configuration configuration)
where TPixel : struct, IPixel<TPixel>
{
TPixel[] palette = new TPixel[this.Palette.Length];
var palette = new TPixel[this.Palette.Length];
Color.ToPixel(configuration, this.Palette.Span, palette.AsSpan());
return new PaletteFrameQuantizer<TPixel>(this.Diffuser, palette);
}
@ -71,11 +71,11 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
maxColors = maxColors.Clamp(QuantizerConstants.MinColors, QuantizerConstants.MaxColors);
int max = Math.Min(maxColors, this.Palette.Length);
TPixel[] palette = new TPixel[max];
var palette = new TPixel[max];
Color.ToPixel(configuration, this.Palette.Span.Slice(0, max), palette.AsSpan());
return new PaletteFrameQuantizer<TPixel>(this.Diffuser, palette);
}
private static IErrorDiffuser GetDiffuser(bool dither) => dither ? KnownDiffusers.FloydSteinberg : null;
}
}
}

6
src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.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;
@ -828,7 +828,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
private void BuildCube()
{
this.colorCube = new Box[this.colors];
double[] vv = new double[this.colors];
var vv = new double[this.colors];
ref Box cube = ref this.colorCube[0];
cube.RMin = cube.GMin = cube.BMin = cube.AMin = 0;
@ -985,4 +985,4 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
}
}
}
}
}

4
tests/ImageSharp.Benchmarks/Codecs/Jpeg/DoubleBufferedStreams.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;
@ -117,7 +117,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
private static byte[] CreateTestBytes()
{
byte[] buffer = new byte[DoubleBufferedStreamReader.ChunkLength * 3];
var buffer = new byte[DoubleBufferedStreamReader.ChunkLength * 3];
var random = new Random();
random.NextBytes(buffer);

8
tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.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;
@ -67,10 +67,10 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
float maxVal = 255f)
{
var rnd = new Random(42);
Buffer2D<float>[] buffers = new Buffer2D<float>[componentCount];
var buffers = new Buffer2D<float>[componentCount];
for (int i = 0; i < componentCount; i++)
{
float[] values = new float[inputBufferLength];
var values = new float[inputBufferLength];
for (int j = 0; j < inputBufferLength; j++)
{
@ -84,4 +84,4 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
return buffers;
}
}
}
}

32
tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs

@ -132,13 +132,13 @@ namespace SixLabors.ImageSharp.Benchmarks
public unsafe void RgbaToYcbCrScalarFloat()
{
// Copy the input to the stack:
OnStackInputCache.Byte input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
var input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
// On-stack output:
Result result = default;
float* yPtr = (float*)&result.Y;
float* cbPtr = (float*)&result.Cb;
float* crPtr = (float*)&result.Cr;
var yPtr = (float*)&result.Y;
var cbPtr = (float*)&result.Cb;
var crPtr = (float*)&result.Cr;
// end of code-bloat block :)
for (int i = 0; i < InputColorCount; i++)
@ -158,20 +158,20 @@ namespace SixLabors.ImageSharp.Benchmarks
public unsafe void RgbaToYcbCrSimdFloat()
{
// Copy the input to the stack:
OnStackInputCache.Byte input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
var input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
// On-stack output:
Result result = default;
float* yPtr = (float*)&result.Y;
float* cbPtr = (float*)&result.Cb;
float* crPtr = (float*)&result.Cr;
var yPtr = (float*)&result.Y;
var cbPtr = (float*)&result.Cb;
var crPtr = (float*)&result.Cr;
// end of code-bloat block :)
for (int i = 0; i < InputColorCount; i++)
{
int i3 = i * 3;
Vector3 vectorRgb = new Vector3(
var vectorRgb = new Vector3(
input.Data[i3 + 0],
input.Data[i3 + 1],
input.Data[i3 + 2]
@ -194,9 +194,9 @@ namespace SixLabors.ImageSharp.Benchmarks
// On-stack output:
Result result = default;
float* yPtr = (float*)&result.Y;
float* cbPtr = (float*)&result.Cb;
float* crPtr = (float*)&result.Cr;
var yPtr = (float*)&result.Y;
var cbPtr = (float*)&result.Cb;
var crPtr = (float*)&result.Cr;
// end of code-bloat block :)
var yCoeffs = new Vector<int>(ScaledCoeffs.Y);
@ -210,7 +210,7 @@ namespace SixLabors.ImageSharp.Benchmarks
for (int i = 0; i < InputColorCount; i += 2)
{
Vector<int> rgb = new Vector<int>(this.inputSourceRGBAsInteger, i * 3);
var rgb = new Vector<int>(this.inputSourceRGBAsInteger, i * 3);
Vector<int> y = yCoeffs * rgb;
Vector<int> cb = cbCoeffs * rgb;
@ -264,7 +264,7 @@ namespace SixLabors.ImageSharp.Benchmarks
for (int i = 0; i < InputColorCount; i += 2)
{
Vector<int> rgb = new Vector<int>(this.inputSourceRGBAsInteger, i * 3);
var rgb = new Vector<int>(this.inputSourceRGBAsInteger, i * 3);
Vector<int> y = yCoeffs * rgb;
Vector<int> cb = cbCoeffs * rgb;
@ -299,7 +299,7 @@ namespace SixLabors.ImageSharp.Benchmarks
public unsafe void RgbaToYcbCrScaledInteger()
{
// Copy the input to the stack:
OnStackInputCache.Byte input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
var input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
// On-stack output:
Result result = default;
@ -338,7 +338,7 @@ namespace SixLabors.ImageSharp.Benchmarks
public unsafe void RgbaToYcbCrScaledIntegerLut()
{
// Copy the input to the stack:
OnStackInputCache.Byte input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
var input = OnStackInputCache.Byte.Create(this.inputSourceRGB);
// On-stack output:
Result result = default;

8
tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@ -253,8 +253,8 @@ namespace SixLabors.ImageSharp.Benchmarks.General.PixelConversion
private static void BitopsSimdImpl(ref Octet.OfUInt32 s, ref Octet.OfUInt32 d)
{
Vector<uint> sVec = Unsafe.As<Octet.OfUInt32, Vector<uint>>(ref s);
Vector<uint> aMask = new Vector<uint>(0xFF00FF00);
Vector<uint> bMask = new Vector<uint>(0x00FF00FF);
var aMask = new Vector<uint>(0xFF00FF00);
var bMask = new Vector<uint>(0x00FF00FF);
Vector<uint> aa = sVec & aMask;
Vector<uint> bb = sVec & bMask;
@ -388,4 +388,4 @@ namespace SixLabors.ImageSharp.Benchmarks.General.PixelConversion
// Bitops_Tuple | 64 | 75.47 ns | 1.1824 ns | 1.1060 ns | 0.91 | 0.01 |
// BitOps_GroupAsULong | 64 | 65.42 ns | 0.7157 ns | 0.6695 ns | 0.79 | 0.01 |
}
}
}

6
tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs

@ -41,14 +41,14 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
[Benchmark]
public void Simd()
{
Vector<uint> v = new Vector<uint>(this.testValue);
var v = new Vector<uint>(this.testValue);
for (int i = 0; i < this.input.Length; i+=Vector<uint>.Count)
{
Vector<uint> a = new Vector<uint>(this.input, i);
var a = new Vector<uint>(this.input, i);
a = Vector.BitwiseOr(a, v);
a.CopyTo(this.result, i);
}
}
}
}
}

8
tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs

@ -41,11 +41,11 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
[Benchmark]
public void SimdMultiplyByVector()
{
Vector<float> v = new Vector<float>(this.testValue);
var v = new Vector<float>(this.testValue);
for (int i = 0; i < this.input.Length; i += Vector<uint>.Count)
{
Vector<float> a = new Vector<float>(this.input, i);
var a = new Vector<float>(this.input, i);
a = a * v;
a.CopyTo(this.result, i);
}
@ -58,10 +58,10 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
for (int i = 0; i < this.input.Length; i += Vector<uint>.Count)
{
Vector<float> a = new Vector<float>(this.input, i);
var a = new Vector<float>(this.input, i);
a = a * v;
a.CopyTo(this.result, i);
}
}
}
}
}

4
tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs

@ -45,10 +45,10 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
for (int i = 0; i < this.input.Length; i += Vector<uint>.Count)
{
Vector<uint> a = new Vector<uint>(this.input, i);
var a = new Vector<uint>(this.input, i);
a = a * v;
a.CopyTo(this.result, i);
}
}
}
}
}

4
tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs

@ -53,10 +53,10 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
{
for (int i = 0; i < this.input.Length; i += Vector<uint>.Count)
{
Vector<uint> a = new Vector<uint>(this.input, i);
var a = new Vector<uint>(this.input, i);
Vector<float> b = Vector.AsVectorSingle(a);
b.CopyTo(this.result, i);
}
}
}
}
}

10
tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs

@ -44,11 +44,11 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
[Benchmark]
public void FetchWithVectorConstructor()
{
Vector<float> v = new Vector<float>(this.testValue);
var v = new Vector<float>(this.testValue);
for (int i = 0; i < this.data.Length; i += Vector<uint>.Count)
{
Vector<float> a = new Vector<float>(this.data, i);
var a = new Vector<float>(this.data, i);
a = a * v;
a.CopyTo(this.data, i);
}
@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
[Benchmark]
public void FetchWithUnsafeCast()
{
Vector<float> v = new Vector<float>(this.testValue);
var v = new Vector<float>(this.testValue);
ref Vector<float> start = ref Unsafe.As<float, Vector<float>>(ref this.data[0]);
int n = this.InputSize / Vector<uint>.Count;
@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
[Benchmark]
public void FetchWithUnsafeCastNoTempVector()
{
Vector<float> v = new Vector<float>(this.testValue);
var v = new Vector<float>(this.testValue);
ref Vector<float> start = ref Unsafe.As<float, Vector<float>>(ref this.data[0]);
int n = this.InputSize / Vector<uint>.Count;
@ -106,4 +106,4 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
}
}
}
}
}

36
tests/ImageSharp.Tests/Color/ColorTests.CastFrom.cs

@ -14,8 +14,8 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void Rgba64()
{
Rgba64 source = new Rgba64(100, 2222, 3333, 4444);
var source = new Rgba64(100, 2222, 3333, 4444);
// Act:
Color color = source;
@ -23,12 +23,12 @@ namespace SixLabors.ImageSharp.Tests
Rgba64 data = color.ToPixel<Rgba64>();
Assert.Equal(source, data);
}
[Fact]
public void Rgba32()
{
Rgba32 source = new Rgba32(1, 22, 33, 231);
var source = new Rgba32(1, 22, 33, 231);
// Act:
Color color = source;
@ -36,12 +36,12 @@ namespace SixLabors.ImageSharp.Tests
Rgba32 data = color.ToPixel<Rgba32>();
Assert.Equal(source, data);
}
[Fact]
public void Argb32()
{
Argb32 source = new Argb32(1, 22, 33, 231);
var source = new Argb32(1, 22, 33, 231);
// Act:
Color color = source;
@ -49,12 +49,12 @@ namespace SixLabors.ImageSharp.Tests
Argb32 data = color.ToPixel<Argb32>();
Assert.Equal(source, data);
}
[Fact]
public void Bgra32()
{
Bgra32 source = new Bgra32(1, 22, 33, 231);
var source = new Bgra32(1, 22, 33, 231);
// Act:
Color color = source;
@ -62,12 +62,12 @@ namespace SixLabors.ImageSharp.Tests
Bgra32 data = color.ToPixel<Bgra32>();
Assert.Equal(source, data);
}
[Fact]
public void Rgb24()
{
Rgb24 source = new Rgb24(1, 22, 231);
var source = new Rgb24(1, 22, 231);
// Act:
Color color = source;
@ -75,12 +75,12 @@ namespace SixLabors.ImageSharp.Tests
Rgb24 data = color.ToPixel<Rgb24>();
Assert.Equal(source, data);
}
[Fact]
public void Bgr24()
{
Bgr24 source = new Bgr24(1, 22, 231);
var source = new Bgr24(1, 22, 231);
// Act:
Color color = source;
@ -90,4 +90,4 @@ namespace SixLabors.ImageSharp.Tests
}
}
}
}
}

48
tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs

@ -14,75 +14,75 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void Rgba64()
{
Rgba64 source = new Rgba64(100, 2222, 3333, 4444);
var source = new Rgba64(100, 2222, 3333, 4444);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Rgba64 data = color;
Assert.Equal(source, data);
}
[Fact]
public void Rgba32()
{
Rgba32 source = new Rgba32(1, 22, 33, 231);
var source = new Rgba32(1, 22, 33, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Rgba32 data = color;
Assert.Equal(source, data);
}
[Fact]
public void Argb32()
{
Argb32 source = new Argb32(1, 22, 33, 231);
var source = new Argb32(1, 22, 33, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Argb32 data = color;
Assert.Equal(source, data);
}
[Fact]
public void Bgra32()
{
Bgra32 source = new Bgra32(1, 22, 33, 231);
var source = new Bgra32(1, 22, 33, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Bgra32 data = color;
Assert.Equal(source, data);
}
[Fact]
public void Rgb24()
{
Rgb24 source = new Rgb24(1, 22, 231);
var source = new Rgb24(1, 22, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Rgb24 data = color;
Assert.Equal(source, data);
}
[Fact]
public void Bgr24()
{
Bgr24 source = new Bgr24(1, 22, 231);
var source = new Bgr24(1, 22, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Bgr24 data = color;
@ -90,4 +90,4 @@ namespace SixLabors.ImageSharp.Tests
}
}
}
}
}

48
tests/ImageSharp.Tests/Color/ColorTests.ConstructFrom.cs

@ -14,75 +14,75 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void Rgba64()
{
Rgba64 source = new Rgba64(100, 2222, 3333, 4444);
var source = new Rgba64(100, 2222, 3333, 4444);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Rgba64 data = color.ToPixel<Rgba64>();
Assert.Equal(source, data);
}
[Fact]
public void Rgba32()
{
Rgba32 source = new Rgba32(1, 22, 33, 231);
var source = new Rgba32(1, 22, 33, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Rgba32 data = color.ToPixel<Rgba32>();
Assert.Equal(source, data);
}
[Fact]
public void Argb32()
{
Argb32 source = new Argb32(1, 22, 33, 231);
var source = new Argb32(1, 22, 33, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Argb32 data = color.ToPixel<Argb32>();
Assert.Equal(source, data);
}
[Fact]
public void Bgra32()
{
Bgra32 source = new Bgra32(1, 22, 33, 231);
var source = new Bgra32(1, 22, 33, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Bgra32 data = color.ToPixel<Bgra32>();
Assert.Equal(source, data);
}
[Fact]
public void Rgb24()
{
Rgb24 source = new Rgb24(1, 22, 231);
var source = new Rgb24(1, 22, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Rgb24 data = color.ToPixel<Rgb24>();
Assert.Equal(source, data);
}
[Fact]
public void Bgr24()
{
Bgr24 source = new Bgr24(1, 22, 231);
var source = new Bgr24(1, 22, 231);
// Act:
Color color = new Color(source);
var color = new Color(source);
// Assert:
Bgr24 data = color.ToPixel<Bgr24>();
@ -90,4 +90,4 @@ namespace SixLabors.ImageSharp.Tests
}
}
}
}
}

24
tests/ImageSharp.Tests/Color/ColorTests.cs

@ -18,47 +18,47 @@ namespace SixLabors.ImageSharp.Tests
Color c1 = Color.FromRgba(111, 222, 55, 255);
Color c2 = c1.WithAlpha(0.5f);
Rgba32 expected = new Rgba32(111, 222, 55, 128);
var expected = new Rgba32(111, 222, 55, 128);
Assert.Equal(expected, (Rgba32)c2);
}
[Fact]
public void Equality_WhenTrue()
{
Color c1 = new Rgba64(100, 2000, 3000, 40000);
Color c2 = new Rgba64(100, 2000, 3000, 40000);
Assert.True(c1.Equals(c2));
Assert.True(c1 == c2);
Assert.False(c1 != c2);
Assert.True(c1.GetHashCode() == c2.GetHashCode());
}
[Fact]
public void Equality_WhenFalse()
{
Color c1 = new Rgba64(100, 2000, 3000, 40000);
Color c2 = new Rgba64(101, 2000, 3000, 40000);
Color c3 = new Rgba64(100, 2000, 3000, 40001);
Assert.False(c1.Equals(c2));
Assert.False(c2.Equals(c3));
Assert.False(c3.Equals(c1));
Assert.False(c1 == c2);
Assert.True(c1 != c2);
Assert.False(c1.Equals(null));
}
[Fact]
public void ToHex()
{
string expected = "ABCD1234";
Color color = Color.FromHex(expected);
string actual = color.ToHex();
Assert.Equal(expected, actual);
}
@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests
Rgba32[] actualPalette = Color.WernerPalette.ToArray().Select(c => (Rgba32)c).ToArray();
Assert.Equal(ReferencePalette.WernerColors, actualPalette);
}
public class FromHex
{
[Fact]
@ -106,4 +106,4 @@ namespace SixLabors.ImageSharp.Tests
}
}
}
}
}

2
tests/ImageSharp.Tests/Colorspaces/RgbTests.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;

22
tests/ImageSharp.Tests/Common/SimdUtilsTests.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;
@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Tests.Common
private static Vector<float> CreateExactTestVector1()
{
float[] data = new float[Vector<float>.Count];
var data = new float[Vector<float>.Count];
data[0] = 0.1f;
data[1] = 0.4f;
@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.Tests.Common
private static Vector<float> CreateRandomTestVector(int seed, float min, float max)
{
float[] data = new float[Vector<float>.Count];
var data = new float[Vector<float>.Count];
var rnd = new Random(seed);
@ -128,7 +128,7 @@ namespace SixLabors.ImageSharp.Tests.Common
float[] orig = new Random(seed).GenerateRandomRoundedFloatArray(count, 0, 256);
float[] normalized = orig.Select(f => f / 255f).ToArray();
byte[] dest = new byte[count];
var dest = new byte[count];
SimdUtils.BasicIntrinsics256.BulkConvertNormalizedFloatToByte(normalized, dest);
@ -151,7 +151,7 @@ namespace SixLabors.ImageSharp.Tests.Common
float[] source = new Random(seed).GenerateRandomFloatArray(count, 0, 1f);
byte[] dest = new byte[count];
var dest = new byte[count];
SimdUtils.BasicIntrinsics256.BulkConvertNormalizedFloatToByte(source, dest);
@ -193,7 +193,7 @@ namespace SixLabors.ImageSharp.Tests.Common
count,
(s, d) => SimdUtils.BasicIntrinsics256.BulkConvertByteToNormalizedFloat(s.Span, d.Span));
}
[Theory]
[MemberData(nameof(ArraySizesDivisibleBy32))]
public void ExtendedIntrinsics_BulkConvertByteToNormalizedFloat(int count)
@ -217,7 +217,7 @@ namespace SixLabors.ImageSharp.Tests.Common
Action<Memory<byte>, Memory<float>> convert)
{
byte[] source = new Random(count).GenerateRandomByteArray(count);
float[] result = new float[count];
var result = new float[count];
float[] expected = source.Select(b => (float)b / 255f).ToArray();
convert(source, result);
@ -306,7 +306,7 @@ namespace SixLabors.ImageSharp.Tests.Common
seed = seed > 0 ? seed : count;
float[] source = new Random(seed).GenerateRandomFloatArray(count, -0.2f, 1.2f);
byte[] expected = source.Select(NormalizedFloatToByte).ToArray();
byte[] actual = new byte[count];
var actual = new byte[count];
convert(source, actual);
@ -325,7 +325,7 @@ namespace SixLabors.ImageSharp.Tests.Common
private void MagicConvertToByte(float value)
{
byte actual = MagicConvert(value / 256f);
byte expected = (byte)value;
var expected = (byte)value;
Assert.Equal(expected, actual);
}
@ -362,7 +362,7 @@ namespace SixLabors.ImageSharp.Tests.Common
{
var magick = new Vector<float>(32768.0f);
Vector<float> scale = new Vector<float>(255f) / new Vector<float>(256f);
var scale = new Vector<float>(255f) / new Vector<float>(256f);
Vector<float> x = MemoryMarshal.Cast<float, Vector<float>>(source)[0];
@ -392,4 +392,4 @@ namespace SixLabors.ImageSharp.Tests.Common
}
}
}
}
}

10
tests/ImageSharp.Tests/Drawing/DrawImageTests.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;
@ -75,13 +75,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing
using (Image<TPixel> image = provider.GetImage())
using (var blend = Image.Load<TPixel>(TestFile.Create(brushImage).Bytes))
{
Size size = new Size(image.Width * 3 / 4, image.Height * 3 / 4);
Point position = new Point(image.Width / 8, image.Height / 8);
var size = new Size(image.Width * 3 / 4, image.Height * 3 / 4);
var position = new Point(image.Width / 8, image.Height / 8);
blend.Mutate(x => x.Resize(size.Width, size.Height, KnownResamplers.Bicubic));
image.Mutate(x => x.DrawImage(blend, position, mode, opacity));
FormattableString testInfo = $"{System.IO.Path.GetFileNameWithoutExtension(brushImage)}-{mode}-{opacity}";
PngEncoder encoder = new PngEncoder();
var encoder = new PngEncoder();
if (provider.PixelType == PixelTypes.Rgba64)
{
@ -197,4 +197,4 @@ namespace SixLabors.ImageSharp.Tests.Drawing
}
}
}

8
tests/ImageSharp.Tests/Drawing/DrawPathTests.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;
@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void PathExtendingOffEdgeOfImageShouldNotBeCropped<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Color color = Color.White;
var color = Color.White;
Pen pen = Pens.Solid(color, 5f);
provider.RunValidatingProcessorTest(
@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
for (int i = 0; i < 300; i += 20)
{
PointF[] points = new PointF[] { new Vector2(100, 2), new Vector2(-10, i) };
var points = new PointF[] { new Vector2(100, 2), new Vector2(-10, i) };
x.DrawLines(pen, points);
}
},
@ -75,4 +75,4 @@ namespace SixLabors.ImageSharp.Tests.Drawing
appendSourceFileOrDescription: false);
}
}
}
}

40
tests/ImageSharp.Tests/Drawing/FillPolygonTests.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;
@ -28,18 +28,18 @@ namespace SixLabors.ImageSharp.Tests.Drawing
new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300)
};
Color color = TestUtils.GetColorByName(colorName).WithAlpha(alpha);
GraphicsOptions options = new GraphicsOptions(antialias);
var options = new GraphicsOptions(antialias);
string aa = antialias ? "" : "_NoAntialias";
FormattableString outputDetails = $"{colorName}_A{alpha}{aa}";
provider.RunValidatingProcessorTest(
c => c.FillPolygon(options, color, simplePath),
outputDetails,
appendSourceFileOrDescription: false);
}
[Theory]
[WithBasicTestPatternImages(200, 200, PixelTypes.Rgba32)]
public void FillPolygon_Concave<TPixel>(TestImageProvider<TPixel> provider)
@ -47,15 +47,15 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
var points = new SixLabors.Primitives.PointF[]
{
new Vector2(8, 8),
new Vector2(64, 8),
new Vector2(64, 64),
new Vector2(8, 8),
new Vector2(64, 8),
new Vector2(64, 64),
new Vector2(120, 64),
new Vector2(120, 120),
new Vector2(120, 120),
new Vector2(8, 120)
};
Color color = Color.LightGreen;
var color = Color.LightGreen;
provider.RunValidatingProcessorTest(
c => c.FillPolygon(color, points),
@ -72,15 +72,15 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300)
};
Color color = Color.Yellow;
var color = Color.Yellow;
var brush = Brushes.Horizontal(color);
provider.RunValidatingProcessorTest(
c => c.FillPolygon(brush, simplePath),
appendSourceFileOrDescription: false);
}
[Theory]
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, TestImages.Png.Ducky)]
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, TestImages.Bmp.Car)]
@ -95,7 +95,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
using (Image<TPixel> brushImage = Image.Load<TPixel>(TestFile.Create(brushImageName).Bytes))
{
var brush = new ImageBrush(brushImage);
provider.RunValidatingProcessorTest(
c => c.FillPolygon(brush, simplePath),
System.IO.Path.GetFileNameWithoutExtension(brushImageName),
@ -109,13 +109,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing
where TPixel : struct, IPixel<TPixel>
{
var polygon = new SixLabors.Shapes.RectangularPolygon(10, 10, 190, 140);
Color color = Color.White;
var color = Color.White;
provider.RunValidatingProcessorTest(
c => c.Fill(color, polygon),
appendSourceFileOrDescription: false);
appendSourceFileOrDescription: false);
}
[Theory]
[WithBasicTestPatternImages(200, 200, PixelTypes.Rgba32, 3, 50, 0f)]
[WithBasicTestPatternImages(200, 200, PixelTypes.Rgba32, 3, 60, 20f)]
@ -127,7 +127,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
float angle = GeometryUtilities.DegreeToRadian(angleDeg);
var polygon = new RegularPolygon(100, 100, vertices, radius, angle);
Color color = Color.Yellow;
var color = Color.Yellow;
FormattableString testOutput = $"V({vertices})_R({radius})_Ang({angleDeg})";
provider.RunValidatingProcessorTest(
@ -143,7 +143,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
where TPixel : struct, IPixel<TPixel>
{
var polygon = new EllipsePolygon(100, 100, 80, 120);
Color color = Color.Azure;
var color = Color.Azure;
provider.RunValidatingProcessorTest(
c => c.Fill(color, polygon),

4
tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs

@ -30,7 +30,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
using (Image<TPixel> image = provider.GetImage())
{
Color color = Color.HotPink;
var color = Color.HotPink;
image.Mutate(c => c.Fill(color));
image.DebugSave(provider, appendPixelTypeToFileName: false);
@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
using (Image<TPixel> image = provider.GetImage())
{
Color color = Color.HotPink;
var color = Color.HotPink;
image.Mutate(c => c.Fill(color));
image.DebugSave(provider, appendSourceFileOrDescription: false);

12
tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs

@ -40,7 +40,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
where TPixel : struct, IPixel<TPixel>
{
Font font = CreateFont("OpenSans-Regular.ttf", 36);
Color color = Color.Black;
var color = Color.Black;
var text = "A short piece of text";
using (var img = provider.GetImage())
@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
float scalingFactor = Math.Min(img.Width / size.Width, img.Height / size.Height);
//create a new font
Font scaledFont = new Font(font, scalingFactor * font.Size);
var scaledFont = new Font(font, scalingFactor * font.Size);
var center = new PointF(img.Width / 2, img.Height / 2);
var textGraphicOptions = new TextGraphicsOptions(true)
@ -80,7 +80,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
where TPixel : struct, IPixel<TPixel>
{
Font font = CreateFont(fontName, fontSize);
Color color = Color.Black;
var color = Color.Black;
provider.VerifyOperation(
TextDrawingComparer,
@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
HorizontalAlignment = HorizontalAlignment.Left,
};
Color color = Color.Black;
var color = Color.Black;
// Based on the reported 0.0270% difference with AccuracyMultiple = 8
// We should avoid quality regressions leading to higher difference!
@ -155,7 +155,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
where TPixel : struct, IPixel<TPixel>
{
Font font = CreateFont(fontName, fontSize);
Color color = Color.Black;
var color = Color.Black;
provider.VerifyOperation(
OutlinedTextDrawingComparer,
@ -182,7 +182,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text
where TPixel : struct, IPixel<TPixel>
{
Font font = CreateFont(fontName, fontSize);
Color color = Color.Black;
var color = Color.Black;
provider.VerifyOperation(
OutlinedTextDrawingComparer,

6
tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs

@ -1,4 +1,4 @@
using System;
using System;
using SixLabors.ImageSharp.Formats.Bmp;
using Xunit;
@ -11,11 +11,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
{
var header = new BmpFileHeader(1, 2, 3, 4);
byte[] buffer = new byte[14];
var buffer = new byte[14];
header.WriteTo(buffer);
Assert.Equal("AQACAAAAAwAAAAQAAAA=", Convert.ToBase64String(buffer));
}
}
}
}

20
tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs

@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
() =>
{
// Block8x8F block = new Block8x8F();
float[] block = new float[64];
var block = new float[64];
for (int i = 0; i < Block8x8F.Size; i++)
{
block[i] = i;
@ -90,8 +90,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Fact]
public void Load_Store_FloatArray()
{
float[] data = new float[Block8x8F.Size];
float[] mirror = new float[Block8x8F.Size];
var data = new float[Block8x8F.Size];
var mirror = new float[Block8x8F.Size];
for (int i = 0; i < Block8x8F.Size; i++)
{
@ -115,8 +115,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Fact]
public unsafe void Load_Store_FloatArray_Ptr()
{
float[] data = new float[Block8x8F.Size];
float[] mirror = new float[Block8x8F.Size];
var data = new float[Block8x8F.Size];
var mirror = new float[Block8x8F.Size];
for (int i = 0; i < Block8x8F.Size; i++)
{
@ -140,8 +140,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Fact]
public void Load_Store_IntArray()
{
int[] data = new int[Block8x8F.Size];
int[] mirror = new int[Block8x8F.Size];
var data = new int[Block8x8F.Size];
var mirror = new int[Block8x8F.Size];
for (int i = 0; i < Block8x8F.Size; i++)
{
@ -174,7 +174,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var dest = new Block8x8F();
source.TransposeInto(ref dest);
float[] actual = new float[64];
var actual = new float[64];
dest.CopyTo(actual);
Assert.Equal(expected, actual);
@ -206,7 +206,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
private static float[] Create8x8ColorCropTestData()
{
float[] result = new float[64];
var result = new float[64];
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
@ -230,7 +230,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
Block8x8F dest = block;
dest.NormalizeColorsInplace(255);
float[] array = new float[64];
var array = new float[64];
dest.CopyTo(array);
this.Output.WriteLine("Result:");
this.PrintLinearData(array);

22
tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void iDCT2D8x4_LeftPart()
{
float[] sourceArray = Create8x8FloatData();
float[] expectedDestArray = new float[64];
var expectedDestArray = new float[64];
ReferenceImplementations.LLM_FloatingPoint_DCT.iDCT2D8x4_32f(sourceArray, expectedDestArray);
@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
FastFloatingPointDCT.IDCT8x4_LeftPart(ref source, ref dest);
float[] actualDestArray = new float[64];
var actualDestArray = new float[64];
dest.CopyTo(actualDestArray);
this.Print8x8Data(expectedDestArray);
@ -47,7 +47,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void iDCT2D8x4_RightPart()
{
float[] sourceArray = Create8x8FloatData();
float[] expectedDestArray = new float[64];
var expectedDestArray = new float[64];
ReferenceImplementations.LLM_FloatingPoint_DCT.iDCT2D8x4_32f(sourceArray.AsSpan(4), expectedDestArray.AsSpan(4));
@ -58,7 +58,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
FastFloatingPointDCT.IDCT8x4_RightPart(ref source, ref dest);
float[] actualDestArray = new float[64];
var actualDestArray = new float[64];
dest.CopyTo(actualDestArray);
this.Print8x8Data(expectedDestArray);
@ -118,12 +118,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var destBlock = new Block8x8F();
float[] expectedDest = new float[64];
var expectedDest = new float[64];
ReferenceImplementations.LLM_FloatingPoint_DCT.fDCT2D8x4_32f(src, expectedDest);
FastFloatingPointDCT.FDCT8x4_LeftPart(ref srcBlock, ref destBlock);
float[] actualDest = new float[64];
var actualDest = new float[64];
destBlock.CopyTo(actualDest);
Assert.Equal(actualDest, expectedDest, new ApproximateFloatComparer(1f));
@ -140,12 +140,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var destBlock = new Block8x8F();
float[] expectedDest = new float[64];
var expectedDest = new float[64];
ReferenceImplementations.LLM_FloatingPoint_DCT.fDCT2D8x4_32f(src.Slice(4), expectedDest.AsSpan(4));
FastFloatingPointDCT.FDCT8x4_RightPart(ref srcBlock, ref destBlock);
float[] actualDest = new float[64];
var actualDest = new float[64];
destBlock.CopyTo(actualDest);
Assert.Equal(actualDest, expectedDest, new ApproximateFloatComparer(1f));
@ -162,14 +162,14 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
var destBlock = new Block8x8F();
float[] expectedDest = new float[64];
float[] temp1 = new float[64];
var expectedDest = new float[64];
var temp1 = new float[64];
var temp2 = new Block8x8F();
ReferenceImplementations.LLM_FloatingPoint_DCT.fDCT2D_llm(src, expectedDest, temp1, downscaleBy8: true);
FastFloatingPointDCT.TransformFDCT(ref srcBlock, ref destBlock, ref temp2, false);
float[] actualDest = new float[64];
var actualDest = new float[64];
destBlock.CopyTo(actualDest);
Assert.Equal(actualDest, expectedDest, new ApproximateFloatComparer(1f));

14
tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.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.
// ReSharper disable InconsistentNaming
@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
// ReSharper disable once InconsistentNaming
public static float[] Create8x8FloatData()
{
float[] result = new float[64];
var result = new float[64];
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
@ -39,7 +39,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
// ReSharper disable once InconsistentNaming
public static int[] Create8x8IntData()
{
int[] result = new int[64];
var result = new int[64];
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
@ -53,7 +53,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
// ReSharper disable once InconsistentNaming
public static short[] Create8x8ShortData()
{
short[] result = new short[64];
var result = new short[64];
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
public static int[] Create8x8RandomIntData(int minValue, int maxValue, int seed = 42)
{
var rnd = new Random(seed);
int[] result = new int[64];
var result = new int[64];
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
@ -90,7 +90,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
public static float[] Create8x8RandomFloatData(float minValue, float maxValue, int seed = 42)
{
var rnd = new Random(seed);
float[] result = new float[64];
var result = new float[64];
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
@ -189,4 +189,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
}
}
}
}
}

2
tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs

@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
result[i] = resultComponent;
}
byte[] buffer = new byte[64 * sizeof(short)];
var buffer = new byte[64 * sizeof(short)];
for (int i = 0; i < result.Length; i++)
{

2
tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs

@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
private static double[,] InitCosLut()
{
double[,] coslu = new double[8, 8];
var coslu = new double[8, 8];
int a, b;
double tmp;

16
tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs

@ -29,10 +29,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
{
public static Block8x8F TransformIDCT(ref Block8x8F source)
{
float[] s = new float[64];
var s = new float[64];
source.CopyTo(s);
float[] d = new float[64];
float[] temp = new float[64];
var d = new float[64];
var temp = new float[64];
iDCT2D_llm(s, d, temp);
Block8x8F result = default;
@ -42,10 +42,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
public static Block8x8F TransformFDCT_UpscaleBy8(ref Block8x8F source)
{
float[] s = new float[64];
var s = new float[64];
source.CopyTo(s);
float[] d = new float[64];
float[] temp = new float[64];
var d = new float[64];
var temp = new float[64];
fDCT2D_llm(s, d, temp);
Block8x8F result = default;
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
public static float[] PrintConstants(ITestOutputHelper output)
{
float[] r = new float[8];
var r = new float[8];
for (int i = 0; i < 8; i++)
{
r[i] = (float)(Cos(i / 16.0 * M_PI) * M_SQRT2);
@ -466,7 +466,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
{
float t0, t1, t2, t3, t4, t5, t6, t7;
float c0, c1, c2, c3;
float[] r = new float[8];
var r = new float[8];
//for(i = 0;i < 8;i++){ r[i] = (float)(cos((double)i / 16.0 * M_PI) * M_SQRT2); }
r[0] = 1.414214f;

6
tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs

@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
public static Block8x8 Subtract128_TransformFDCT_Upscale8(ref Block8x8 block)
{
int[] temp = new int[Block8x8.Size];
var temp = new int[Block8x8.Size];
block.CopyTo(temp);
Subtract128_TransformFDCT_Upscale8_Inplace(temp);
var result = default(Block8x8);
@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
// [Obsolete("Looks like this method produces really bad results for bigger values!")]
public static Block8x8 TransformIDCT(ref Block8x8 block)
{
int[] temp = new int[Block8x8.Size];
var temp = new int[Block8x8.Size];
block.CopyTo(temp);
TransformIDCTInplace(temp);
var result = default(Block8x8);
@ -364,4 +364,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
}
}
}
}
}

6
tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs

@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
/// <returns>A new <see cref="Span{T}"/> with float values</returns>
public static float[] ConvertAllToFloat(this int[] src)
{
float[] result = new float[src.Length];
var result = new float[src.Length];
for (int i = 0; i < src.Length; i++)
{
result[i] = src[i];
@ -92,7 +92,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
/// <returns>A new instance of <see cref="Span{T}"/></returns>
public static Span<float> AddScalarToAllValues(this Span<float> src, float scalar)
{
float[] result = new float[src.Length];
var result = new float[src.Length];
for (int i = 0; i < src.Length; i++)
{
result[i] = src[i] + scalar;
@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
/// <returns>A new instance of <see cref="Span{T}"/></returns>
public static Span<int> AddScalarToAllValues(this Span<int> src, int scalar)
{
int[] result = new int[src.Length];
var result = new int[src.Length];
for (int i = 0; i < src.Length; i++)
{
result[i] = src[i] + scalar;

2
tests/ImageSharp.Tests/Formats/Jpg/ZigZagTests.cs

@ -12,7 +12,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void ZigZagCanHandleAllPossibleCoefficients()
{
// Mimic the behaviour of the huffman scan decoder using all possible byte values
short[] block = new short[64];
var block = new short[64];
var zigzag = ZigZag.CreateUnzigTable();
for (int h = 0; h < 255; h++)

6
tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs

@ -1,4 +1,4 @@
using System.Buffers.Binary;
using System.Buffers.Binary;
using System.IO;
using System.Text;
@ -96,7 +96,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
private static string GetChunkTypeName(uint value)
{
byte[] data = new byte[4];
var data = new byte[4];
BinaryPrimitives.WriteUInt32BigEndian(data, value);
@ -125,4 +125,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
memStream.Position = 0;
}
}
}
}

4
tests/ImageSharp.Tests/Helpers/ParallelHelperTests.cs

@ -97,7 +97,7 @@ namespace SixLabors.ImageSharp.Tests.Helpers
int[] expectedData = Enumerable.Repeat(0, minY).Concat(Enumerable.Range(minY, maxY - minY)).ToArray();
int[] actualData = new int[maxY];
var actualData = new int[maxY];
ParallelHelper.IterateRows(
rectangle,
@ -172,7 +172,7 @@ namespace SixLabors.ImageSharp.Tests.Helpers
var rectangle = new Rectangle(0, minY, 10, maxY - minY);
int[] expectedData = Enumerable.Repeat(0, minY).Concat(Enumerable.Range(minY, maxY - minY)).ToArray();
int[] actualData = new int[maxY];
var actualData = new int[maxY];
ParallelHelper.IterateRowsWithTempBuffer(
rectangle,

28
tests/ImageSharp.Tests/Helpers/RowIntervalTests.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;
@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Tests.Helpers
var rows = new RowInterval(min, max);
Span<int> span = buffer.GetMultiRowSpan(rows);
ref int expected0 = ref buffer.Span[min * width];
int expectedLength = (max - min) * width;
@ -38,9 +38,9 @@ namespace SixLabors.ImageSharp.Tests.Helpers
[Fact]
public void Slice1()
{
RowInterval rowInterval = new RowInterval(10, 20);
var rowInterval = new RowInterval(10, 20);
RowInterval sliced = rowInterval.Slice(5);
Assert.Equal(15, sliced.Min);
Assert.Equal(20, sliced.Max);
}
@ -48,9 +48,9 @@ namespace SixLabors.ImageSharp.Tests.Helpers
[Fact]
public void Slice2()
{
RowInterval rowInterval = new RowInterval(10, 20);
var rowInterval = new RowInterval(10, 20);
RowInterval sliced = rowInterval.Slice(3, 5);
Assert.Equal(13, sliced.Min);
Assert.Equal(18, sliced.Max);
}
@ -58,9 +58,9 @@ namespace SixLabors.ImageSharp.Tests.Helpers
[Fact]
public void Equality_WhenTrue()
{
RowInterval a = new RowInterval(42, 123);
RowInterval b = new RowInterval(42, 123);
var a = new RowInterval(42, 123);
var b = new RowInterval(42, 123);
Assert.True(a.Equals(b));
Assert.True(a.Equals((object)b));
Assert.True(a == b);
@ -70,14 +70,14 @@ namespace SixLabors.ImageSharp.Tests.Helpers
[Fact]
public void Equality_WhenFalse()
{
RowInterval a = new RowInterval(42, 123);
RowInterval b = new RowInterval(42, 125);
RowInterval c = new RowInterval(40, 123);
var a = new RowInterval(42, 123);
var b = new RowInterval(42, 125);
var c = new RowInterval(40, 123);
Assert.False(a.Equals(b));
Assert.False(c.Equals(a));
Assert.False(b.Equals(c));
Assert.False(a.Equals((object)b));
Assert.False(a.Equals(null));
Assert.False(a == b);

8
tests/ImageSharp.Tests/IO/DoubleBufferedStreamReaderTests.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,7 +83,7 @@ namespace SixLabors.ImageSharp.Tests.IO
{
using (MemoryStream stream = this.CreateTestStream())
{
byte[] buffer = new byte[2];
var buffer = new byte[2];
byte[] expected = stream.ToArray();
var reader = new DoubleBufferedStreamReader(this.allocator, stream);
@ -102,7 +102,7 @@ namespace SixLabors.ImageSharp.Tests.IO
{
using (MemoryStream stream = this.CreateTestStream())
{
byte[] buffer = new byte[2];
var buffer = new byte[2];
byte[] expected = stream.ToArray();
var reader = new DoubleBufferedStreamReader(this.allocator, stream);
@ -167,7 +167,7 @@ namespace SixLabors.ImageSharp.Tests.IO
private MemoryStream CreateTestStream()
{
byte[] buffer = new byte[DoubleBufferedStreamReader.ChunkLength * 3];
var buffer = new byte[DoubleBufferedStreamReader.ChunkLength * 3];
var random = new Random();
random.NextBytes(buffer);

6
tests/ImageSharp.Tests/Image/ImageCloneTests.cs

@ -1,4 +1,4 @@
using System;
using System;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
using Xunit;
@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void CloneAs_WhenDisposed_Throws()
{
Image<Rgba32> image = new Image<Rgba32>(5, 5);
var image = new Image<Rgba32>(5, 5);
image.Dispose();
Assert.Throws<ObjectDisposedException>(() => image.CloneAs<Bgra32>());
@ -19,7 +19,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void Clone_WhenDisposed_Throws()
{
Image<Rgba32> image = new Image<Rgba32>(5, 5);
var image = new Image<Rgba32>(5, 5);
image.Dispose();
Assert.Throws<ObjectDisposedException>(() => image.Clone());

18
tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs

@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void AddFrame_OfDifferentPixelType()
{
using (Image<Bgra32> sourceImage = new Image<Bgra32>(
using (var sourceImage = new Image<Bgra32>(
this.Image.GetConfiguration(),
this.Image.Width,
this.Image.Height,
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests
Enumerable.Repeat(Rgba32.Blue, this.Image.Width * this.Image.Height).ToArray();
Assert.Equal(2, this.Collection.Count);
ImageFrame<Rgba32> actualFrame = (ImageFrame<Rgba32>)this.Collection[1];
var actualFrame = (ImageFrame<Rgba32>)this.Collection[1];
actualFrame.ComparePixelBufferTo(expectedAllBlue);
}
@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void InsertFrame_OfDifferentPixelType()
{
using (Image<Bgra32> sourceImage = new Image<Bgra32>(
using (var sourceImage = new Image<Bgra32>(
this.Image.GetConfiguration(),
this.Image.Width,
this.Image.Height,
@ -58,7 +58,7 @@ namespace SixLabors.ImageSharp.Tests
Enumerable.Repeat(Rgba32.Blue, this.Image.Width * this.Image.Height).ToArray();
Assert.Equal(2, this.Collection.Count);
ImageFrame<Rgba32> actualFrame = (ImageFrame<Rgba32>)this.Collection[0];
var actualFrame = (ImageFrame<Rgba32>)this.Collection[0];
actualFrame.ComparePixelBufferTo(expectedAllBlue);
@ -160,7 +160,7 @@ namespace SixLabors.ImageSharp.Tests
{
Assert.Equal(2, img.Frames.Count);
Image<TPixel> expectedClone = (Image<TPixel>)cloned;
var expectedClone = (Image<TPixel>)cloned;
expectedClone.ComparePixelBufferTo(img.GetPixelSpan());
}
@ -183,7 +183,7 @@ namespace SixLabors.ImageSharp.Tests
{
Assert.Equal(1, img.Frames.Count);
Image<TPixel> expectedClone = (Image<TPixel>)cloned;
var expectedClone = (Image<TPixel>)cloned;
expectedClone.ComparePixelBufferTo(sourcePixelData);
}
}
@ -196,7 +196,7 @@ namespace SixLabors.ImageSharp.Tests
Assert.Equal(2, this.Image.Frames.Count);
ImageFrame<Rgba32> frame = (ImageFrame<Rgba32>)this.Image.Frames[1];
var frame = (ImageFrame<Rgba32>)this.Image.Frames[1];
frame.ComparePixelBufferTo(default(Rgba32));
}
@ -208,7 +208,7 @@ namespace SixLabors.ImageSharp.Tests
Assert.Equal(2, this.Image.Frames.Count);
ImageFrame<Rgba32> frame = (ImageFrame<Rgba32>)this.Image.Frames[1];
var frame = (ImageFrame<Rgba32>)this.Image.Frames[1];
frame.ComparePixelBufferTo(Rgba32.HotPink);
}
@ -273,7 +273,7 @@ namespace SixLabors.ImageSharp.Tests
where TPixel : struct, IPixel<TPixel>
{
using (Image source = provider.GetImage())
using (Image<TPixel> dest = new Image<TPixel>(source.GetConfiguration(), source.Width, source.Height))
using (var dest = new Image<TPixel>(source.GetConfiguration(), source.Width, source.Height))
{
// Giphy.gif has 5 frames

8
tests/ImageSharp.Tests/Image/ImageSaveTests.cs

@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void SavePath()
{
Stream stream = new MemoryStream();
var stream = new MemoryStream();
this.fileSystem.Setup(x => x.Create("path.png")).Returns(stream);
this.Image.Save("path.png");
@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void SavePathWithEncoder()
{
Stream stream = new MemoryStream();
var stream = new MemoryStream();
this.fileSystem.Setup(x => x.Create("path.jpg")).Returns(stream);
this.Image.Save("path.jpg", this.encoderNotInFormat.Object);
@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void SaveStreamWithMime()
{
Stream stream = new MemoryStream();
var stream = new MemoryStream();
this.Image.Save(stream, this.localImageFormat.Object);
this.encoder.Verify(x => x.Encode(this.Image, stream));
@ -87,7 +87,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void SaveStreamWithEncoder()
{
Stream stream = new MemoryStream();
var stream = new MemoryStream();
this.Image.Save(stream, this.encoderNotInFormat.Object);

20
tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs

@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Tests
this.TestFormat.VerifySpecificDecodeCall<Rgb24>(this.Marker, this.TopLevelConfiguration);
}
[Theory]
[InlineData(false)]
[InlineData(true)]
@ -47,14 +47,14 @@ namespace SixLabors.ImageSharp.Tests
this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration);
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void Configuration_Bytes_Decoder_Specific(bool useSpan)
{
TestFormat localFormat = new TestFormat();
var localFormat = new TestFormat();
var img = useSpan ?
Image.Load<Rgba32>(this.TopLevelConfiguration, this.ByteSpan, localFormat.Decoder) :
Image.Load<Rgba32>(this.TopLevelConfiguration, this.ByteArray, localFormat.Decoder);
@ -62,14 +62,14 @@ namespace SixLabors.ImageSharp.Tests
Assert.NotNull(img);
localFormat.VerifySpecificDecodeCall<Rgba32>(this.Marker, this.TopLevelConfiguration);
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void Configuration_Bytes_Decoder_Agnostic(bool useSpan)
{
TestFormat localFormat = new TestFormat();
var localFormat = new TestFormat();
var img = useSpan ?
Image.Load(this.TopLevelConfiguration, this.ByteSpan, localFormat.Decoder) :
Image.Load(this.TopLevelConfiguration, this.ByteArray, localFormat.Decoder);
@ -90,10 +90,10 @@ namespace SixLabors.ImageSharp.Tests
Assert.NotNull(img);
Assert.Equal(this.TestFormat, format);
this.TestFormat.VerifySpecificDecodeCall<Bgr24>(this.Marker, this.TopLevelConfiguration);
}
[Theory]
[InlineData(false)]
[InlineData(true)]
@ -106,7 +106,7 @@ namespace SixLabors.ImageSharp.Tests
Assert.NotNull(img);
Assert.Equal(this.TestFormat, format);
this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration);
}
}

22
tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_PassLocalConfiguration.cs

@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Tests
this.TestFormat.VerifySpecificDecodeCall<Rgb24>(this.Marker, this.TopLevelConfiguration);
}
[Fact]
public void Configuration_Stream_Agnostic()
{
@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests
this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration);
}
[Fact]
public void NonSeekableStream()
{
@ -46,21 +46,21 @@ namespace SixLabors.ImageSharp.Tests
this.TestFormat.VerifySpecificDecodeCall<Rgba32>(this.Marker, this.TopLevelConfiguration);
}
[Fact]
public void Configuration_Stream_Decoder_Specific()
{
Stream stream = new MemoryStream();
var stream = new MemoryStream();
var img = Image.Load<Rgba32>(this.TopLevelConfiguration, stream, this.localDecoder.Object);
Assert.NotNull(img);
this.localDecoder.Verify(x => x.Decode<Rgba32>(this.TopLevelConfiguration, stream));
}
[Fact]
public void Configuration_Stream_Decoder_Agnostic()
{
Stream stream = new MemoryStream();
var stream = new MemoryStream();
var img = Image.Load(this.TopLevelConfiguration, stream, this.localDecoder.Object);
Assert.NotNull(img);
@ -74,10 +74,10 @@ namespace SixLabors.ImageSharp.Tests
Assert.NotNull(img);
Assert.Equal(this.TestFormat, format);
this.TestFormat.VerifySpecificDecodeCall<Rgba32>(this.Marker, this.TopLevelConfiguration);
}
[Fact]
public void Configuration_Stream_OutFormat_Agnostic()
{
@ -85,9 +85,9 @@ namespace SixLabors.ImageSharp.Tests
Assert.NotNull(img);
Assert.Equal(this.TestFormat, format);
this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration);
}
}
}
}
}
}

2
tests/ImageSharp.Tests/Image/ImageTests.Save.cs

@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests
var image = new Image<Rgba32>(5, 5);
image.Dispose();
IImageEncoder encoder = Mock.Of<IImageEncoder>();
using (MemoryStream stream = new MemoryStream())
using (var stream = new MemoryStream())
{
Assert.Throws<ObjectDisposedException>(() => image.Save(stream, encoder));
}

4
tests/ImageSharp.Tests/ImageOperationTests.cs

@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Tests
{
this.provider = new FakeImageOperationsProvider();
Mock<IImageProcessor> processorMock = new Mock<IImageProcessor>();
var processorMock = new Mock<IImageProcessor>();
this.processorDefinition = processorMock.Object;
this.image = new Image<Rgba32>(new Configuration
@ -155,7 +155,7 @@ namespace SixLabors.ImageSharp.Tests
{
try
{
Image<Rgba32> img = new Image<Rgba32>(1, 1);
var img = new Image<Rgba32>(1, 1);
img.Dispose();
img.EnsureNotDisposed();
}

12
tests/ImageSharp.Tests/Memory/Buffer2DTests.cs

@ -137,11 +137,11 @@ namespace SixLabors.ImageSharp.Tests.Memory
[InlineData(5, 1, 1, 3, 2)]
public void CopyColumns(int width, int height, int startIndex, int destIndex, int columnCount)
{
Random rnd = new Random(123);
var rnd = new Random(123);
using (Buffer2D<float> b = this.MemoryAllocator.Allocate2D<float>(width, height))
{
rnd.RandomFill(b.Span, 0, 1);
b.CopyColumns(startIndex, destIndex, columnCount);
for (int y = 0; y < b.Height; y++)
@ -150,7 +150,7 @@ namespace SixLabors.ImageSharp.Tests.Memory
Span<float> s = row.Slice(startIndex, columnCount);
Span<float> d = row.Slice(destIndex, columnCount);
Xunit.Assert.True(s.SequenceEqual(d));
}
}
@ -159,11 +159,11 @@ namespace SixLabors.ImageSharp.Tests.Memory
[Fact]
public void CopyColumns_InvokeMultipleTimes()
{
Random rnd = new Random(123);
var rnd = new Random(123);
using (Buffer2D<float> b = this.MemoryAllocator.Allocate2D<float>(100, 100))
{
rnd.RandomFill(b.Span, 0, 1);
b.CopyColumns(0, 50, 22);
b.CopyColumns(0, 50, 22);
@ -173,7 +173,7 @@ namespace SixLabors.ImageSharp.Tests.Memory
Span<float> s = row.Slice(0, 22);
Span<float> d = row.Slice(50, 22);
Xunit.Assert.True(s.SequenceEqual(d));
}
}

6
tests/ImageSharp.Tests/Memory/BufferAreaTests.cs

@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Tests.Memory
{
using (Buffer2D<int> buffer = CreateTestBuffer(20, 30))
{
Rectangle r = new Rectangle(rx, ry, 5, 6);
var r = new Rectangle(rx, ry, 5, 6);
BufferArea<int> area = buffer.GetArea(r);
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Memory
{
using (Buffer2D<int> buffer = CreateTestBuffer(20, 30))
{
Rectangle r = new Rectangle(rx, ry, w, h);
var r = new Rectangle(rx, ry, w, h);
BufferArea<int> area = buffer.GetArea(r);
@ -145,4 +145,4 @@ namespace SixLabors.ImageSharp.Tests.Memory
}
}
}
}
}

2
tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Tests.Icc
public void CalculateHash_WithByteArray_DoesNotModifyData()
{
byte[] data = IccTestDataProfiles.Profile_Random_Array;
byte[] copy = new byte[data.Length];
var copy = new byte[data.Length];
Buffer.BlockCopy(data, 0, copy, 0, data.Length);
IccProfile.CalculateHash(data);

6
tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccWriterTests.cs

@ -13,12 +13,12 @@ namespace SixLabors.ImageSharp.Tests.Icc
{
IccWriter writer = CreateWriter();
IccProfile profile = new IccProfile
var profile = new IccProfile
{
Header = IccTestDataProfiles.Header_Random_Write
};
byte[] output = writer.Write(profile);
Assert.Equal(IccTestDataProfiles.Header_Random_Array, output);
}
@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.Tests.Icc
IccWriter writer = CreateWriter();
byte[] output = writer.Write(IccTestDataProfiles.Profile_Random_Val);
Assert.Equal(IccTestDataProfiles.Profile_Random_Array, output);
}

22
tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs

@ -297,7 +297,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
{
const int Count = 2134;
TPixel[] source = CreatePixelTestData(Count);
TDestPixel[] expected = new TDestPixel[Count];
var expected = new TDestPixel[Count];
PixelConverterTests.ReferenceImplementations.To<TPixel, TDestPixel>(this.Configuration, source, expected);
@ -457,7 +457,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToArgb32Bytes(int count)
{
TPixel[] source = CreatePixelTestData(count);
byte[] expected = new byte[count * 4];
var expected = new byte[count * 4];
var argb = default(Argb32);
for (int i = 0; i < count; i++)
@ -504,7 +504,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToBgr24Bytes(int count)
{
TPixel[] source = CreatePixelTestData(count);
byte[] expected = new byte[count * 3];
var expected = new byte[count * 3];
var bgr = default(Bgr24);
for (int i = 0; i < count; i++)
@ -549,7 +549,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToBgra32Bytes(int count)
{
TPixel[] source = CreatePixelTestData(count);
byte[] expected = new byte[count * 4];
var expected = new byte[count * 4];
var bgra = default(Bgra32);
for (int i = 0; i < count; i++)
@ -595,7 +595,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToRgb24Bytes(int count)
{
TPixel[] source = CreatePixelTestData(count);
byte[] expected = new byte[count * 3];
var expected = new byte[count * 3];
var rgb = default(Rgb24);
for (int i = 0; i < count; i++)
@ -640,7 +640,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToRgba32Bytes(int count)
{
TPixel[] source = CreatePixelTestData(count);
byte[] expected = new byte[count * 4];
var expected = new byte[count * 4];
var rgba = default(Rgba32);
for (int i = 0; i < count; i++)
@ -686,7 +686,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToRgb48Bytes(int count)
{
TPixel[] source = CreatePixelTestData(count);
byte[] expected = new byte[count * 6];
var expected = new byte[count * 6];
Rgb48 rgb = default;
for (int i = 0; i < count; i++)
@ -735,7 +735,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToRgba64Bytes(int count)
{
TPixel[] source = CreatePixelTestData(count);
byte[] expected = new byte[count * 8];
var expected = new byte[count * 8];
Rgba64 rgba = default;
for (int i = 0; i < count; i++)
@ -787,7 +787,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToGray8(int count)
{
TPixel[] source = CreatePixelTestData(count);
Gray8[] expected = new Gray8[count];
var expected = new Gray8[count];
for (int i = 0; i < count; i++)
{
@ -831,7 +831,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
public void ToGray16(int count)
{
TPixel[] source = CreatePixelTestData(count);
Gray16[] expected = new Gray16[count];
var expected = new Gray16[count];
for (int i = 0; i < count; i++)
{
@ -946,7 +946,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations
internal static byte[] CreateByteTestData(int length)
{
byte[] result = new byte[length];
var result = new byte[length];
var rnd = new Random(42); // Deterministic random values
for (int i = 0; i < result.Length; i++)

88
tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.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;
@ -65,16 +65,16 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
public void Rgba64_FromScaledVector4(ushort r, ushort g, ushort b, ushort a)
{
// arrange
var source = new Rgba64(r, g, b, a);
// act
// act
Vector4 scaled = source.ToScaledVector4();
Rgba64 actual = default;
actual.FromScaledVector4(scaled);
// assert
Assert.Equal(source, actual);
}
@ -104,7 +104,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
// assert
Assert.Equal(expected, actual);
}
[Fact]
public void Rgba64_FromBgra5551()
@ -126,20 +126,20 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
[Fact]
public void Equality_WhenTrue()
{
Rgba64 c1 = new Rgba64(100, 2000, 3000, 40000);
Rgba64 c2 = new Rgba64(100, 2000, 3000, 40000);
var c1 = new Rgba64(100, 2000, 3000, 40000);
var c2 = new Rgba64(100, 2000, 3000, 40000);
Assert.True(c1.Equals(c2));
Assert.True(c1.GetHashCode() == c2.GetHashCode());
}
[Fact]
public void Equality_WhenFalse()
{
Rgba64 c1 = new Rgba64(100, 2000, 3000, 40000);
Rgba64 c2 = new Rgba64(101, 2000, 3000, 40000);
Rgba64 c3 = new Rgba64(100, 2000, 3000, 40001);
var c1 = new Rgba64(100, 2000, 3000, 40000);
var c2 = new Rgba64(101, 2000, 3000, 40000);
var c3 = new Rgba64(100, 2000, 3000, 40001);
Assert.False(c1.Equals(c2));
Assert.False(c2.Equals(c3));
Assert.False(c3.Equals(c1));
@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
Rgba64 actual = default;
actual.FromRgba32(source);
Assert.Equal(expected, actual);
}
@ -162,127 +162,127 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
{
var expected = new Rgba64(5140, 9766, 19532, 29555);
var source = new Rgba32(20, 38, 76, 115);
Rgba64 actual = new Rgba64(source);
var actual = new Rgba64(source);
Assert.Equal(expected, actual);
}
[Fact]
public void ConstructFrom_Bgra32()
{
var expected = new Rgba64(5140, 9766, 19532, 29555);
var source = new Bgra32(20, 38, 76, 115);
Rgba64 actual = new Rgba64(source);
var actual = new Rgba64(source);
Assert.Equal(expected, actual);
}
[Fact]
public void ConstructFrom_Argb32()
{
var expected = new Rgba64(5140, 9766, 19532, 29555);
var source = new Argb32(20, 38, 76, 115);
Rgba64 actual = new Rgba64(source);
var actual = new Rgba64(source);
Assert.Equal(expected, actual);
}
[Fact]
public void ConstructFrom_Rgb24()
{
var expected = new Rgba64(5140, 9766, 19532, ushort.MaxValue);
var source = new Rgb24(20, 38, 76);
Rgba64 actual = new Rgba64(source);
var actual = new Rgba64(source);
Assert.Equal(expected, actual);
}
[Fact]
public void ConstructFrom_Bgr24()
{
var expected = new Rgba64(5140, 9766, 19532, ushort.MaxValue);
var source = new Bgr24(20, 38, 76);
Rgba64 actual = new Rgba64(source);
var actual = new Rgba64(source);
Assert.Equal(expected, actual);
}
[Fact]
public void ConstructFrom_Vector4()
{
Vector4 source = new Vector4(0f, 0.2f, 0.5f, 1f);
var source = new Vector4(0f, 0.2f, 0.5f, 1f);
Rgba64 expected = default;
expected.FromScaledVector4(source);
Rgba64 actual = new Rgba64(source);
var actual = new Rgba64(source);
Assert.Equal(expected, actual);
}
[Fact]
public void ToRgba32_Retval()
{
// arrange
var source = new Rgba64(5140, 9766, 19532, 29555);
var expected = new Rgba32(20, 38, 76, 115);
// act
var actual = source.ToRgba32();
// assert
Assert.Equal(expected, actual);
}
[Fact]
public void ToBgra32_Retval()
{
// arrange
var source = new Rgba64(5140, 9766, 19532, 29555);
var expected = new Bgra32(20, 38, 76, 115);
// act
var actual = source.ToBgra32();
// assert
Assert.Equal(expected, actual);
}
[Fact]
public void ToArgb32_Retval()
{
// arrange
var source = new Rgba64(5140, 9766, 19532, 29555);
var expected = new Argb32(20, 38, 76, 115);
// act
var actual = source.ToArgb32();
// assert
Assert.Equal(expected, actual);
}
[Fact]
public void ToRgb24_Retval()
{
// arrange
var source = new Rgba64(5140, 9766, 19532, 29555);
var expected = new Rgb24(20, 38, 76);
// act
var actual = source.ToRgb24();
// assert
Assert.Equal(expected, actual);
}
[Fact]
public void ToBgr24_Retval()
{
// arrange
var source = new Rgba64(5140, 9766, 19532, 29555);
var expected = new Bgr24(20, 38, 76);
// act
var actual = source.ToBgr24();

4
tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs

@ -19,7 +19,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Normalization
public void HistogramEqualizationTest(int luminanceLevels)
{
// Arrange
byte[] pixels = new byte[]
var pixels = new byte[]
{
52, 55, 61, 59, 70, 61, 76, 61,
62, 59, 55, 104, 94, 85, 59, 71,
@ -42,7 +42,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Normalization
}
}
byte[] expected = new byte[]
var expected = new byte[]
{
0, 12, 53, 32, 146, 53, 174, 53,
57, 32, 12, 227, 219, 202, 32, 154,

6
tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs

@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
image.Metadata.ExifProfile = new ExifProfile();
image.Metadata.ExifProfile.SetValue(ExifTag.Orientation, orientation);
image.Mutate(x => x.AutoOrient());
image.DebugSave(provider, orientation, appendPixelTypeToFileName: false);
image.CompareToReferenceOutput(provider, orientation, appendPixelTypeToFileName: false);
@ -71,8 +71,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
bytes[18] = (byte)dataType;
// Change the number of components
bytes[20] = 1;
byte[] orientationCodeData = new byte[8];
var orientationCodeData = new byte[8];
Array.Copy(orientation, orientationCodeData, orientation.Length);
ulong orientationCode = BitConverter.ToUInt64(orientationCodeData, 0);

6
tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.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.PixelFormats;
@ -40,7 +40,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
public void ImageShouldPadWithBackgroundColor<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Color color = Color.Red;
var color = Color.Red;
TPixel expected = color.ToPixel<TPixel>();
using (Image<TPixel> image = provider.GetImage())
{
@ -58,4 +58,4 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
}
}
}
}
}

6
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.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;
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
double sum = 0;
double[] values = new double[right - left + 1];
var values = new double[right - left + 1];
for (int j = left; j <= right; j++)
{
@ -108,4 +108,4 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
}
}
}
}
}

4
tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs

@ -102,7 +102,7 @@ namespace SixLabors.ImageSharp.Tests
{
foreach (object[] row in memberData)
{
object[] actualFactoryMethodArgs = new object[originalFactoryMethodArgs.Length + 2];
var actualFactoryMethodArgs = new object[originalFactoryMethodArgs.Length + 2];
Array.Copy(originalFactoryMethodArgs, actualFactoryMethodArgs, originalFactoryMethodArgs.Length);
actualFactoryMethodArgs[actualFactoryMethodArgs.Length - 2] = testMethod;
actualFactoryMethodArgs[actualFactoryMethodArgs.Length - 1] = kv.Key;
@ -110,7 +110,7 @@ namespace SixLabors.ImageSharp.Tests
object factory = factoryType.GetMethod(this.GetFactoryMethodName(testMethod))
.Invoke(null, actualFactoryMethodArgs);
object[] result = new object[this.AdditionalParameters.Length + 1 + row.Length];
var result = new object[this.AdditionalParameters.Length + 1 + row.Length];
result[0] = factory;
Array.Copy(row, 0, result, 1, row.Length);
Array.Copy(this.AdditionalParameters, 0, result, 1 + row.Length, this.AdditionalParameters.Length);

2
tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs

@ -198,7 +198,7 @@ namespace SixLabors.ImageSharp.Tests
int pixelCount = left * top;
uint stepsPerPixel = (uint)(uint.MaxValue / pixelCount);
TPixel c = default;
Rgba32 t = new Rgba32(0);
var t = new Rgba32(0);
for (int x = left; x < right; x++)
{

12
tests/ImageSharp.Tests/TestUtilities/TestDataGenerator.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;
@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Tests
/// <returns>The <see cref="float[]"/>.</returns>
public static float[] GenerateRandomFloatArray(this Random rnd, int length, float minVal, float maxVal)
{
float[] values = new float[length];
var values = new float[length];
RandomFill(rnd, values, minVal, maxVal);
@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.Tests
/// <returns>The <see cref="float[]"/>.</returns>
public static float[] GenerateRandomRoundedFloatArray(this Random rnd, int length, float minVal, float maxVal)
{
float[] values = new float[length];
var values = new float[length];
for (int i = 0; i < length; i++)
{
@ -88,14 +88,14 @@ namespace SixLabors.ImageSharp.Tests
/// <returns>The <see cref="byte[]"/>.</returns>
public static byte[] GenerateRandomByteArray(this Random rnd, int length)
{
byte[] values = new byte[length];
var values = new byte[length];
rnd.NextBytes(values);
return values;
}
public static short[] GenerateRandomInt16Array(this Random rnd, int length, short minVal, short maxVal)
{
short[] values = new short[length];
var values = new short[length];
for (int i = 0; i < values.Length; i++)
{
values[i] = (short)rnd.Next(minVal, maxVal);
@ -106,4 +106,4 @@ namespace SixLabors.ImageSharp.Tests
private static float GetRandomFloat(this Random rnd, float minVal, float maxVal) => ((float)rnd.NextDouble() * (maxVal - minVal)) + minVal;
}
}
}

Loading…
Cancel
Save