Browse Source

Add additional checks

pull/1721/head
James Jackson-South 5 years ago
parent
commit
8238c8fd6f
  1. 2
      src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs
  2. 2
      src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs

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

@ -27,6 +27,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Dithering
[MethodImpl(InliningOptions.ShortMethod)]
public ErrorDither(in DenseMatrix<float> matrix, int offset)
{
Guard.MustBeGreaterThan(offset, 0, nameof(offset));
this.matrix = matrix;
this.offset = offset;
}

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

@ -24,6 +24,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Dithering
[MethodImpl(InliningOptions.ShortMethod)]
public OrderedDither(uint length)
{
Guard.MustBeGreaterThan(length, 0, nameof(length));
DenseMatrix<uint> ditherMatrix = OrderedDitherFactory.CreateDitherMatrix(length);
// Create a new matrix to run against, that pre-thresholds the values.

Loading…
Cancel
Save