Browse Source

Remove nullable disable and fix Equals

pull/2312/head
Stefan Nikolei 4 years ago
parent
commit
9b91a9e5a3
  1. 3
      src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs
  2. 3
      src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetector2DKernel.cs
  3. 3
      src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorCompassKernel.cs
  4. 3
      src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorKernel.cs
  5. 3
      src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurParameters.cs
  6. 7
      src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs
  7. 7
      src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs
  8. 5
      src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs

3
src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
namespace SixLabors.ImageSharp.Processing.Processors.Convolution; namespace SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -99,7 +98,7 @@ internal static class ConvolutionProcessorHelpers
/// <param name="row">The resulting 1D row vector, if possible.</param> /// <param name="row">The resulting 1D row vector, if possible.</param>
/// <param name="column">The resulting 1D column vector, if possible.</param> /// <param name="column">The resulting 1D column vector, if possible.</param>
/// <returns>Whether or not <paramref name="matrix"/> was linearly separable.</returns> /// <returns>Whether or not <paramref name="matrix"/> was linearly separable.</returns>
public static bool TryGetLinearlySeparableComponents(this DenseMatrix<float> matrix, out float[] row, out float[] column) public static bool TryGetLinearlySeparableComponents(this DenseMatrix<float> matrix, out float[]? row, out float[]? column)
{ {
int height = matrix.Rows; int height = matrix.Rows;
int width = matrix.Columns; int width = matrix.Columns;

3
src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetector2DKernel.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
namespace SixLabors.ImageSharp.Processing.Processors.Convolution; namespace SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -88,7 +87,7 @@ public readonly struct EdgeDetector2DKernel : IEquatable<EdgeDetector2DKernel>
=> !(left == right); => !(left == right);
/// <inheritdoc/> /// <inheritdoc/>
public override bool Equals(object obj) public override bool Equals(object? obj)
=> obj is EdgeDetector2DKernel kernel && this.Equals(kernel); => obj is EdgeDetector2DKernel kernel && this.Equals(kernel);
/// <inheritdoc/> /// <inheritdoc/>

3
src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorCompassKernel.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
namespace SixLabors.ImageSharp.Processing.Processors.Convolution; namespace SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -135,7 +134,7 @@ public readonly struct EdgeDetectorCompassKernel : IEquatable<EdgeDetectorCompas
=> !(left == right); => !(left == right);
/// <inheritdoc/> /// <inheritdoc/>
public override bool Equals(object obj) => obj is EdgeDetectorCompassKernel kernel && this.Equals(kernel); public override bool Equals(object? obj) => obj is EdgeDetectorCompassKernel kernel && this.Equals(kernel);
/// <inheritdoc/> /// <inheritdoc/>
public bool Equals(EdgeDetectorCompassKernel other) => this.North.Equals(other.North) && this.NorthWest.Equals(other.NorthWest) && this.West.Equals(other.West) && this.SouthWest.Equals(other.SouthWest) && this.South.Equals(other.South) && this.SouthEast.Equals(other.SouthEast) && this.East.Equals(other.East) && this.NorthEast.Equals(other.NorthEast); public bool Equals(EdgeDetectorCompassKernel other) => this.North.Equals(other.North) && this.NorthWest.Equals(other.NorthWest) && this.West.Equals(other.West) && this.SouthWest.Equals(other.SouthWest) && this.South.Equals(other.South) && this.SouthEast.Equals(other.SouthEast) && this.East.Equals(other.East) && this.NorthEast.Equals(other.NorthEast);

3
src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorKernel.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
namespace SixLabors.ImageSharp.Processing.Processors.Convolution; namespace SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -64,7 +63,7 @@ public readonly struct EdgeDetectorKernel : IEquatable<EdgeDetectorKernel>
=> !(left == right); => !(left == right);
/// <inheritdoc/> /// <inheritdoc/>
public override bool Equals(object obj) public override bool Equals(object? obj)
=> obj is EdgeDetectorKernel kernel && this.Equals(kernel); => obj is EdgeDetectorKernel kernel && this.Equals(kernel);
/// <inheritdoc/> /// <inheritdoc/>

3
src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurParameters.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
namespace SixLabors.ImageSharp.Processing.Processors.Convolution.Parameters; namespace SixLabors.ImageSharp.Processing.Processors.Convolution.Parameters;
@ -37,7 +36,7 @@ internal readonly struct BokehBlurParameters : IEquatable<BokehBlurParameters>
} }
/// <inheritdoc/> /// <inheritdoc/>
public override bool Equals(object obj) => obj is BokehBlurParameters other && this.Equals(other); public override bool Equals(object? obj) => obj is BokehBlurParameters other && this.Equals(other);
/// <inheritdoc/> /// <inheritdoc/>
public override int GetHashCode() public override int GetHashCode()

7
src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
using System.Numerics; using System.Numerics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -212,7 +211,7 @@ public readonly partial struct ErrorDither : IDither, IEquatable<ErrorDither>, I
} }
/// <inheritdoc/> /// <inheritdoc/>
public override bool Equals(object obj) public override bool Equals(object? obj)
=> obj is ErrorDither dither && this.Equals(dither); => obj is ErrorDither dither && this.Equals(dither);
/// <inheritdoc/> /// <inheritdoc/>
@ -220,8 +219,8 @@ public readonly partial struct ErrorDither : IDither, IEquatable<ErrorDither>, I
=> this.offset == other.offset && this.matrix.Equals(other.matrix); => this.offset == other.offset && this.matrix.Equals(other.matrix);
/// <inheritdoc/> /// <inheritdoc/>
public bool Equals(IDither other) public bool Equals(IDither? other)
=> this.Equals((object)other); => this.Equals((object?)other);
/// <inheritdoc/> /// <inheritdoc/>
public override int GetHashCode() public override int GetHashCode()

7
src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.Memory;
@ -200,7 +199,7 @@ public readonly partial struct OrderedDither : IDither, IEquatable<OrderedDither
} }
/// <inheritdoc/> /// <inheritdoc/>
public override bool Equals(object obj) public override bool Equals(object? obj)
=> obj is OrderedDither dither && this.Equals(dither); => obj is OrderedDither dither && this.Equals(dither);
/// <inheritdoc/> /// <inheritdoc/>
@ -209,8 +208,8 @@ public readonly partial struct OrderedDither : IDither, IEquatable<OrderedDither
=> this.thresholdMatrix.Equals(other.thresholdMatrix) && this.modulusX == other.modulusX && this.modulusY == other.modulusY; => this.thresholdMatrix.Equals(other.thresholdMatrix) && this.modulusX == other.modulusX && this.modulusY == other.modulusY;
/// <inheritdoc/> /// <inheritdoc/>
public bool Equals(IDither other) public bool Equals(IDither? other)
=> this.Equals((object)other); => this.Equals((object?)other);
/// <inheritdoc/> /// <inheritdoc/>
[MethodImpl(InliningOptions.ShortMethod)] [MethodImpl(InliningOptions.ShortMethod)]

5
src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs

@ -1,6 +1,5 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
#nullable disable
using System.Buffers; using System.Buffers;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
@ -19,7 +18,7 @@ internal sealed class PaletteDitherProcessor<TPixel> : ImageProcessor<TPixel>
{ {
private readonly DitherProcessor ditherProcessor; private readonly DitherProcessor ditherProcessor;
private readonly IDither dither; private readonly IDither dither;
private IMemoryOwner<TPixel> paletteOwner; private IMemoryOwner<TPixel>? paletteOwner;
private bool isDisposed; private bool isDisposed;
/// <summary> /// <summary>
@ -62,7 +61,7 @@ internal sealed class PaletteDitherProcessor<TPixel> : ImageProcessor<TPixel>
this.isDisposed = true; this.isDisposed = true;
if (disposing) if (disposing)
{ {
this.paletteOwner.Dispose(); this.paletteOwner?.Dispose();
this.ditherProcessor.Dispose(); this.ditherProcessor.Dispose();
} }

Loading…
Cancel
Save