From f1f8f6f8d1936e26ca43ebbb441d47c2cd61e725 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 23:30:55 +0200 Subject: [PATCH] Resolved SA1129. --- src/ImageSharp/Common/Helpers/ImageMaths.cs | 4 ++-- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 6 +++--- src/ImageSharp/Formats/Gif/PackedField.cs | 2 +- src/ImageSharp/Profiles/Exif/ExifReader.cs | 4 ++-- .../Processors/Convolution/Convolution2PassFilter.cs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs index fe487323e..9a32eb5c1 100644 --- a/src/ImageSharp/Common/Helpers/ImageMaths.cs +++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs @@ -171,8 +171,8 @@ namespace ImageSharp const float Epsilon = .00001f; int width = bitmap.Width; int height = bitmap.Height; - Point topLeft = new Point(); - Point bottomRight = new Point(); + Point topLeft = default(Point); + Point bottomRight = default(Point); Func, int, int, float, bool> delegateFunc; diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 5614f6246..cd7e600bb 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -168,7 +168,7 @@ namespace ImageSharp.Formats writer.Write((ushort)descriptor.Width); writer.Write((ushort)descriptor.Height); - PackedField field = new PackedField(); + PackedField field = default(PackedField); field.SetBit(0, descriptor.GlobalColorTableFlag); // 1 : Global color table flag = 1 || 0 (GCT used/ not used) field.SetBits(1, 3, descriptor.GlobalColorTableSize); // 2-4 : color resolution field.SetBit(4, false); // 5 : GCT sort flag = 0 @@ -254,7 +254,7 @@ namespace ImageSharp.Formats writer.Write(intro); - PackedField field = new PackedField(); + PackedField field = default(PackedField); field.SetBits(3, 3, (int)extension.DisposalMethod); // 1-3 : Reserved, 4-6 : Disposal // TODO: Allow this as an option. @@ -285,7 +285,7 @@ namespace ImageSharp.Formats writer.Write((ushort)image.Width); writer.Write((ushort)image.Height); - PackedField field = new PackedField(); + PackedField field = default(PackedField); field.SetBit(0, true); // 1: Local color table flag = 1 (LCT used) field.SetBit(1, false); // 2: Interlace flag 0 field.SetBit(2, false); // 3: Sort flag 0 diff --git a/src/ImageSharp/Formats/Gif/PackedField.cs b/src/ImageSharp/Formats/Gif/PackedField.cs index 4713a6533..8c5e59105 100644 --- a/src/ImageSharp/Formats/Gif/PackedField.cs +++ b/src/ImageSharp/Formats/Gif/PackedField.cs @@ -55,7 +55,7 @@ namespace ImageSharp.Formats /// The public static PackedField FromInt(byte value) { - PackedField packed = new PackedField(); + PackedField packed = default(PackedField); packed.SetBits(0, 8, value); return packed; } diff --git a/src/ImageSharp/Profiles/Exif/ExifReader.cs b/src/ImageSharp/Profiles/Exif/ExifReader.cs index 6d18078f7..6fcf95e1a 100644 --- a/src/ImageSharp/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/Profiles/Exif/ExifReader.cs @@ -442,7 +442,7 @@ namespace ImageSharp { if (!this.ValidateArray(data, 8, 4)) { - return new Rational(); + return default(Rational); } uint numerator = BitConverter.ToUInt32(data, 0); @@ -470,7 +470,7 @@ namespace ImageSharp { if (!this.ValidateArray(data, 8, 4)) { - return new SignedRational(); + return default(SignedRational); } int numerator = BitConverter.ToInt32(data, 0); diff --git a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs index c9893d62d..4cab6f0b2 100644 --- a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs +++ b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs @@ -85,7 +85,7 @@ namespace ImageSharp.Processors { for (int x = startX; x < endX; x++) { - Vector4 destination = new Vector4(); + Vector4 destination = default(Vector4); // Apply each matrix multiplier to the color components for each pixel. for (int fy = 0; fy < kernelHeight; fy++)