Skip to content

Commit 0e40d71

Browse files
committed
Change Guard
removed the generic constrained of IResampler and added notnull
1 parent f047392 commit 0e40d71

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/ImageSharp/Common/Helpers/Guard.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Runtime.CompilerServices;
55
using SixLabors.ImageSharp;
6-
using SixLabors.ImageSharp.Processing.Processors.Transforms;
76

87
namespace SixLabors;
98

@@ -17,8 +16,8 @@ internal static partial class Guard
1716
/// <typeparam name="TValue">The type of the value.</typeparam>
1817
/// <exception cref="ArgumentException"><paramref name="value"/> is not a value type.</exception>
1918
[MethodImpl(InliningOptions.ShortMethod)]
20-
public static void SamplerMustBeValueType<TValue>(TValue value, [CallerArgumentExpression("value")] string? parameterName = null)
21-
where TValue : IResampler
19+
public static void MustBeValueType<TValue>(TValue value, [CallerArgumentExpression("value")] string? parameterName = null)
20+
where TValue : notnull
2221
{
2322
if (value.GetType().IsValueType)
2423
{

src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class AffineTransformProcessor : CloningImageProcessor
1919
public AffineTransformProcessor(Matrix3x2 matrix, IResampler sampler, Size targetDimensions)
2020
{
2121
Guard.NotNull(sampler, nameof(sampler));
22-
Guard.SamplerMustBeValueType(sampler);
22+
Guard.MustBeValueType(sampler);
2323

2424
if (TransformUtils.IsDegenerate(matrix))
2525
{

src/ImageSharp/Processing/Processors/Transforms/Linear/ProjectiveTransformProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public sealed class ProjectiveTransformProcessor : CloningImageProcessor
1919
public ProjectiveTransformProcessor(Matrix4x4 matrix, IResampler sampler, Size targetDimensions)
2020
{
2121
Guard.NotNull(sampler, nameof(sampler));
22-
Guard.SamplerMustBeValueType(sampler);
22+
Guard.MustBeValueType(sampler);
2323

2424
if (TransformUtils.IsDegenerate(matrix))
2525
{

src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public ResizeProcessor(ResizeOptions options, Size sourceSize)
1717
{
1818
Guard.NotNull(options, nameof(options));
1919
Guard.NotNull(options.Sampler, nameof(options.Sampler));
20-
Guard.SamplerMustBeValueType(options.Sampler);
20+
Guard.MustBeValueType(options.Sampler);
2121

2222
(Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds(sourceSize, options);
2323

0 commit comments

Comments
 (0)