Browse Source

Replace == null with is null

af/merge-core
Jason Nelson 8 years ago
parent
commit
d773ba37af
  1. 5
      src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor.cs
  2. 2
      src/ImageSharp/Common/Helpers/DebugGuard.cs
  3. 6
      src/ImageSharp/Common/Helpers/Guard.cs
  4. 4
      src/ImageSharp/Formats/Gif/GifDecoderCore.cs
  5. 2
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs
  6. 3
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs
  7. 9
      src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.cs
  8. 4
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
  9. 6
      src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
  10. 4
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  11. 2
      src/ImageSharp/Formats/Png/Zlib/ZlibInflateStream.cs
  12. 2
      src/ImageSharp/Image.Decode.cs
  13. 6
      src/ImageSharp/ImageExtensions.cs
  14. 9
      src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs
  15. 2
      src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs
  16. 3
      src/ImageSharp/MetaData/Profiles/Exif/ExifTagDescriptionAttribute.cs
  17. 10
      src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs
  18. 4
      src/ImageSharp/MetaData/Profiles/ICC/Curves/IccCurveSegment.cs
  19. 2
      src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
  20. 2
      src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
  21. 2
      src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Primitives.cs
  22. 6
      src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
  23. 4
      src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs
  24. 2
      src/ImageSharp/MetaData/Profiles/ICC/IccTagDataEntry.cs
  25. 2
      src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMultiProcessElement.cs
  26. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
  27. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
  28. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
  29. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs
  30. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
  31. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
  32. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs
  33. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
  34. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
  35. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
  36. 10
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs
  37. 10
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs
  38. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs
  39. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
  40. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
  41. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs
  42. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
  43. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
  44. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
  45. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
  46. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
  47. 2
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
  48. 2
      src/ImageSharp/PixelFormats/ColorBuilder{TPixel}.cs
  49. 4
      src/ImageSharp/Processing/DefaultInternalImageProcessorContext.cs
  50. 6
      src/ImageSharp/Processing/Processors/Quantization/OctreeFrameQuantizer{TPixel}.cs
  51. 2
      src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs
  52. 4
      src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs
  53. 2
      src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs
  54. 2
      src/ImageSharp/Processing/Processors/Transforms/TransformHelpers.cs
  55. 4
      tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs
  56. 4
      tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs
  57. 4
      tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs

5
src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor.cs

@ -37,9 +37,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Text
{
Guard.NotNull(text, nameof(text));
Guard.NotNull(font, nameof(font));
if (brush == null && pen == null)
if (brush is null && pen is null)
{
throw new ArgumentNullException($"at least one of {nameof(brush)} or {nameof(pen)} must not be null");
throw new ArgumentNullException($"Expected a {nameof(brush)} or {nameof(pen)}. Both were null");
}
this.Options = options;

2
src/ImageSharp/Common/Helpers/DebugGuard.cs

@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp
public static void NotNull<T>(T value, string parameterName)
where T : class
{
if (value == null)
if (value is null)
{
throw new ArgumentNullException(parameterName);
}

6
src/ImageSharp/Common/Helpers/Guard.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp
public static void NotNull<T>(T value, string parameterName)
where T : class
{
if (value == null)
if (value is null)
{
throw new ArgumentNullException(parameterName);
}
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp
/// <exception cref="ArgumentException"><paramref name="value"/> is empty or contains only blanks.</exception>
public static void NotNullOrWhiteSpace(string value, string parameterName)
{
if (value == null)
if (value is null)
{
throw new ArgumentNullException(parameterName);
}
@ -58,7 +58,7 @@ namespace SixLabors.ImageSharp
/// <exception cref="ArgumentException"><paramref name="value"/> is empty.</exception>
public static void NotNullOrEmpty<T>(ICollection<T> value, string parameterName)
{
if (value == null)
if (value is null)
{
throw new ArgumentNullException(parameterName);
}

4
src/ImageSharp/Formats/Gif/GifDecoderCore.cs

@ -377,7 +377,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
ImageFrame<TPixel> currentFrame = null;
ImageFrame<TPixel> imageFrame;
if (previousFrame == null)
if (previousFrame is null)
{
// This initializes the image to become fully transparent because the alpha channel is zero.
image = new Image<TPixel>(this.configuration, imageWidth, imageHeight, this.metaData);
@ -485,7 +485,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
private void RestoreToBackground<TPixel>(ImageFrame<TPixel> frame)
where TPixel : struct, IPixel<TPixel>
{
if (this.restoreArea == null)
if (this.restoreArea is null)
{
return;
}

2
src/ImageSharp/Formats/Gif/GifEncoderCore.cs

@ -159,7 +159,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
{
foreach (ImageFrame<TPixel> frame in image.Frames)
{
if (quantized == null)
if (quantized is null)
{
quantized = this.quantizer.CreateFrameQuantizer<TPixel>().QuantizeFrame(frame);
}

3
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs

@ -44,7 +44,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
public static JpegColorConverter GetConverter(JpegColorSpace colorSpace)
{
JpegColorConverter converter = Converters.FirstOrDefault(c => c.ColorSpace == colorSpace);
if (converter == null)
if (converter is null)
{
throw new Exception($"Could not find any converter for JpegColorSpace {colorSpace}!");
}

9
src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.cs

@ -58,13 +58,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
public void LoadAndStretchEdges<TPixel>(IPixelSource<TPixel> source, int sourceX, int sourceY)
where TPixel : struct, IPixel<TPixel>
{
var buffer = source.PixelBuffer as Buffer2D<T>;
if (buffer == null)
if (source.PixelBuffer is Buffer2D<T> buffer)
{
this.LoadAndStretchEdges(buffer, sourceX, sourceY);
}
else
{
throw new InvalidOperationException("LoadAndStretchEdges<TPixels>() is only valid for TPixel == T !");
}
this.LoadAndStretchEdges(buffer, sourceX, sourceY);
}
/// <summary>

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

@ -538,7 +538,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
if (ProfileResolver.IsProfile(profile, ProfileResolver.ExifMarker))
{
this.isExif = true;
if (this.exifData == null)
if (this.exifData is null)
{
// The first 6 bytes (Exif00) will be skipped, because this is Jpeg specific
this.exifData = profile.Skip(Exif00).ToArray();
@ -575,7 +575,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
byte[] profile = new byte[remaining];
this.InputStream.Read(profile, 0, remaining);
if (this.iccData == null)
if (this.iccData is null)
{
this.iccData = profile;
}

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

@ -628,7 +628,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
byte[] data = exifProfile?.ToByteArray();
if (data == null || data.Length == 0)
if (data is null || data.Length == 0)
{
return;
}
@ -687,7 +687,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
/// </exception>
private void WriteIccProfile(IccProfile iccProfile)
{
if (iccProfile == null)
if (iccProfile is null)
{
return;
}
@ -698,7 +698,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
byte[] data = iccProfile.ToByteArray();
if (data == null || data.Length == 0)
if (data is null || data.Length == 0)
{
return;
}

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

@ -239,7 +239,7 @@ namespace SixLabors.ImageSharp.Formats.Png
this.ReadPhysicalChunk(metadata, chunk.Data.GetSpan());
break;
case PngChunkType.Data:
if (image == null)
if (image is null)
{
this.InitializeImage(metadata, out image);
}
@ -283,7 +283,7 @@ namespace SixLabors.ImageSharp.Formats.Png
}
}
if (image == null)
if (image is null)
{
throw new ImageFormatException("PNG Image does not contain a data chunk");
}

2
src/ImageSharp/Formats/Png/Zlib/ZlibInflateStream.cs

@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.Formats.Png.Zlib
public void AllocateNewBytes(int bytes)
{
this.currentDataRemaining = bytes;
if (this.compressedStream == null)
if (this.compressedStream is null)
{
this.InitializeInflateStream();
}

2
src/ImageSharp/Image.Decode.cs

@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp
where TPixel : struct, IPixel<TPixel>
{
IImageDecoder decoder = DiscoverDecoder(stream, config, out IImageFormat format);
if (decoder == null)
if (decoder is null)
{
return (null, null);
}

6
src/ImageSharp/ImageExtensions.cs

@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp
string ext = Path.GetExtension(filePath);
IImageFormat format = source.GetConfiguration().ImageFormatsManager.FindFormatByFileExtension(ext);
if (format == null)
if (format is null)
{
var sb = new StringBuilder();
sb.AppendLine($"Can't find a format that is associated with the file extention '{ext}'. Registered formats with there extensions include:");
@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp
IImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
if (encoder == null)
if (encoder is null)
{
var sb = new StringBuilder();
sb.AppendLine($"Can't find encoder for file extention '{ext}' using image format '{format.Name}'. Registered encoders include:");
@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp
Guard.NotNull(format, nameof(format));
IImageEncoder encoder = source.GetConfiguration().ImageFormatsManager.FindEncoder(format);
if (encoder == null)
if (encoder is null)
{
var sb = new StringBuilder();
sb.AppendLine("Can't find encoder for provided mime type. Available encoded:");

9
src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs

@ -128,7 +128,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
return null;
}
if (this.data == null || this.data.Length < (this.thumbnailOffset + this.thumbnailLength))
if (this.data is null || this.data.Length < (this.thumbnailOffset + this.thumbnailLength))
{
return null;
}
@ -235,7 +235,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
/// <returns>The <see cref="T:byte[]"/></returns>
public byte[] ToByteArray()
{
if (this.values == null)
if (this.values is null)
{
return this.data;
}
@ -262,7 +262,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
private void SyncResolution(ExifTag tag, double resolution)
{
ExifValue value = this.GetValue(tag);
if (value == null)
if (value is null)
{
return;
}
@ -283,7 +284,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
return;
}
if (this.data == null)
if (this.data is null)
{
this.values = new List<ExifValue>();
return;

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

@ -202,7 +202,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
private object ConvertValue(ExifDataType dataType, ReadOnlySpan<byte> buffer, uint numberOfComponents)
{
if (buffer == null || buffer.Length == 0)
if (buffer.Length == 0)
{
return null;
}

3
src/ImageSharp/MetaData/Profiles/Exif/ExifTagDescriptionAttribute.cs

@ -37,7 +37,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
public static string GetDescription(ExifTag tag, object value)
{
FieldInfo field = tag.GetType().GetTypeInfo().GetDeclaredField(tag.ToString());
if (field == null)
if (field is null)
{
return null;
}

10
src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs

@ -80,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
{
get
{
if (this.Value == null)
if (this.Value is null)
{
return false;
}
@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
{
get
{
if (this.Value == null)
if (this.Value is null)
{
return 4;
}
@ -213,7 +213,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
/// <inheritdoc/>
public override string ToString()
{
if (this.Value == null)
if (this.Value is null)
{
return null;
}
@ -589,7 +589,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
type = type.GetElementType();
}
if (type == null || type == typeof(ushort))
if (type is null || type == typeof(ushort))
{
return new ExifValue(tag, ExifDataType.Short, value, isArray);
}
@ -616,7 +616,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
/// </exception>
private void CheckValue(object value)
{
if (value == null)
if (value is null)
{
return;
}

4
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccCurveSegment.cs

@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public virtual bool Equals(IccCurveSegment other)
{
if (other == null)
if (other is null)
{
return false;
}
@ -40,4 +40,4 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return this.Signature == other.Signature;
}
}
}
}

2
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs

@ -41,7 +41,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public bool Equals(IccOneDimensionalCurve other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs

@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccResponseCurve other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Primitives.cs

@ -199,7 +199,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
Guard.MustBeGreaterThan(length, 0, nameof(length));
if (value == null)
if (value is null)
{
value = string.Empty;
}

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

@ -901,7 +901,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int size, count = 0;
if (value.Ascii == null)
if (value.Ascii is null)
{
count += this.WriteUInt32(0);
}
@ -914,7 +914,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
this.dataStream.Position += size;
}
if (value.Unicode == null)
if (value.Unicode is null)
{
count += this.WriteUInt32(0);
count += this.WriteUInt32(0);
@ -929,7 +929,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
this.dataStream.Position += size;
}
if (value.ScriptCode == null)
if (value.ScriptCode is null)
{
count += this.WriteUInt16(0);
count += this.WriteByte(0);

4
src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs

@ -200,7 +200,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return;
}
if (this.data == null)
if (this.data is null)
{
this.header = new IccProfileHeader();
return;
@ -217,7 +217,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return;
}
if (this.data == null)
if (this.data is null)
{
this.entries = new List<IccTagDataEntry>();
return;

2
src/ImageSharp/MetaData/Profiles/ICC/IccTagDataEntry.cs

@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public virtual bool Equals(IccTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMultiProcessElement.cs

@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public virtual bool Equals(IccMultiProcessElement other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs

@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
this.ChannelValues = channelValues;
int channelLength = channelValues[0].Length;
bool channelsNotSame = channelValues.Any(t => t == null || t.Length != channelLength);
bool channelsNotSame = channelValues.Any(t => t is null || t.Length != channelLength);
Guard.IsFalse(channelsNotSame, nameof(channelValues), "The number of values per channel is not the same for all channels");
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs

@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccColorantOrderTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs

@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccColorantTableTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs

@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccCrdInfoTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs

@ -96,7 +96,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccCurveTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs

@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccDataTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs

@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccDateTimeTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccFix16ArrayTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs

@ -117,7 +117,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccLut16TagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs

@ -120,7 +120,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccLut8TagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

10
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs

@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccLutAToBTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}
@ -200,8 +200,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
private bool EqualsCurve(IccTagDataEntry[] thisCurves, IccTagDataEntry[] entryCurves)
{
bool thisNull = thisCurves == null;
bool entryNull = entryCurves == null;
bool thisNull = thisCurves is null;
bool entryNull = entryCurves is null;
if (thisNull && entryNull)
{
@ -271,7 +271,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
private Vector3? CreateMatrix3x1(float[] matrix)
{
if (matrix == null)
if (matrix is null)
{
return null;
}
@ -281,7 +281,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
private Matrix4x4? CreateMatrix3x3(float[,] matrix)
{
if (matrix == null)
if (matrix is null)
{
return null;
}

10
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs

@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccLutBToATagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}
@ -200,8 +200,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
private bool EqualsCurve(IccTagDataEntry[] thisCurves, IccTagDataEntry[] entryCurves)
{
bool thisNull = thisCurves == null;
bool entryNull = entryCurves == null;
bool thisNull = thisCurves is null;
bool entryNull = entryCurves is null;
if (thisNull && entryNull)
{
@ -271,7 +271,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
private Vector3? CreateMatrix3x1(float[] matrix)
{
if (matrix == null)
if (matrix is null)
{
return null;
}
@ -281,7 +281,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
private Matrix4x4? CreateMatrix3x3(float[,] matrix)
{
if (matrix == null)
if (matrix is null)
{
return null;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs

@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccMeasurementTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs

@ -47,7 +47,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccMultiLocalizedUnicodeTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs

@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccMultiProcessElementsTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs

@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <returns>The converted entry</returns>
public static explicit operator IccMultiLocalizedUnicodeTagDataEntry(IccTextDescriptionTagDataEntry textEntry)
{
if (textEntry == null)
if (textEntry is null)
{
return null;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccUInt32ArrayTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs

@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccUInt64ArrayTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccUInt8ArrayTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs

@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccUcrBgTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccUnknownTagDataEntry other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs

@ -116,7 +116,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public bool Equals(IccClut other)
{
if (other == null)
if (other is null)
{
return false;
}

2
src/ImageSharp/PixelFormats/ColorBuilder{TPixel}.cs

@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.PixelFormats
hex = ToRgbaHex(hex);
if (hex == null || !uint.TryParse(hex, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint packedValue))
if (hex is null || !uint.TryParse(hex, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint packedValue))
{
throw new ArgumentException("Hexadecimal string is not in the correct format.", nameof(hex));
}

4
src/ImageSharp/Processing/DefaultInternalImageProcessorContext.cs

@ -41,7 +41,7 @@ namespace SixLabors.ImageSharp.Processing
/// <inheritdoc/>
public Image<TPixel> Apply()
{
if (!this.mutate && this.destination == null)
if (!this.mutate && this.destination is null)
{
// Ensure we have cloned it if we are not mutating as we might have failed to register any processors
this.destination = this.source.Clone();
@ -56,7 +56,7 @@ namespace SixLabors.ImageSharp.Processing
/// <inheritdoc/>
public IImageProcessingContext<TPixel> ApplyProcessor(IImageProcessor<TPixel> processor, Rectangle rectangle)
{
if (!this.mutate && this.destination == null)
if (!this.mutate && this.destination is null)
{
// This will only work if the first processor applied is the cloning one thus
// realistically for this optimization to work the resize must the first processor

6
src/ImageSharp/Processing/Processors/Quantization/OctreeFrameQuantizer{TPixel}.cs

@ -233,7 +233,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
{
// If so, check if I have a previous node setup. This will only occur if the first color in the image
// happens to be black, with an alpha component of zero.
if (this.previousNode == null)
if (this.previousNode is null)
{
this.previousColor = pixel;
this.root.AddColor(ref pixel, this.maxColorBits, 0, this, ref rgba);
@ -309,7 +309,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
{
// Find the deepest level containing at least one reducible node
int index = this.maxColorBits - 1;
while ((index > 0) && (this.ReducibleNodes[index] == null))
while ((index > 0) && (this.ReducibleNodes[index] is null))
{
index--;
}
@ -440,7 +440,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
| ((rgba.R & Mask[level]) >> shift);
OctreeNode child = this.children[index];
if (child == null)
if (child is null)
{
// Create a new child node and store it in the array
child = new OctreeNode(level + 1, colorBits, octree);

2
src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs

@ -166,7 +166,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
/// <inheritdoc/>
protected override TPixel[] GetPalette()
{
if (this.palette == null)
if (this.palette is null)
{
this.palette = new TPixel[this.colors];
for (int k = 0; k < this.colors; k++)

4
src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs

@ -73,13 +73,13 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
/// <returns>The <see cref="OrientationMode"/></returns>
private static OrientationMode GetExifOrientation(Image<TPixel> source)
{
if (source.MetaData.ExifProfile == null)
if (source.MetaData.ExifProfile is null)
{
return OrientationMode.Unknown;
}
ExifValue value = source.MetaData.ExifProfile.GetValue(ExifTag.Orientation);
if (value == null)
if (value is null)
{
return OrientationMode.Unknown;
}

2
src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs

@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
protected override void AfterImageApply(Image<TPixel> source, Image<TPixel> destination, Rectangle sourceRectangle)
{
ExifProfile profile = destination.MetaData.ExifProfile;
if (profile == null)
if (profile is null)
{
return;
}

2
src/ImageSharp/Processing/Processors/Transforms/TransformHelpers.cs

@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
where TPixel : struct, IPixel<TPixel>
{
ExifProfile profile = image.MetaData.ExifProfile;
if (profile == null)
if (profile is null)
{
return;
}

4
tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs

@ -73,9 +73,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);
if (property == null)
if (property is null)
{
throw new Exception("Invalid property name!");
throw new Exception($"No resampler named '{name}");
}
return (IResampler)property.GetValue(null);

4
tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs

@ -228,9 +228,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{
PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);
if (property == null)
if (property is null)
{
throw new Exception("Invalid property name!");
throw new Exception($"No resampler named {name}");
}
return (IResampler)property.GetValue(null);

4
tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs

@ -124,9 +124,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
{
PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);
if (property == null)
if (property is null)
{
throw new Exception("Invalid property name!");
throw new Exception($"No resampler named {name}");
}
return (IResampler)property.GetValue(null);

Loading…
Cancel
Save