Browse Source

Resolved SA1129.

af/merge-core
dirk 10 years ago
parent
commit
f1f8f6f8d1
  1. 4
      src/ImageSharp/Common/Helpers/ImageMaths.cs
  2. 6
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs
  3. 2
      src/ImageSharp/Formats/Gif/PackedField.cs
  4. 4
      src/ImageSharp/Profiles/Exif/ExifReader.cs
  5. 2
      src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs

4
src/ImageSharp/Common/Helpers/ImageMaths.cs

@ -171,8 +171,8 @@ namespace ImageSharp
const float Epsilon = .00001f; const float Epsilon = .00001f;
int width = bitmap.Width; int width = bitmap.Width;
int height = bitmap.Height; int height = bitmap.Height;
Point topLeft = new Point(); Point topLeft = default(Point);
Point bottomRight = new Point(); Point bottomRight = default(Point);
Func<PixelAccessor<TColor, TPacked>, int, int, float, bool> delegateFunc; Func<PixelAccessor<TColor, TPacked>, int, int, float, bool> delegateFunc;

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

@ -168,7 +168,7 @@ namespace ImageSharp.Formats
writer.Write((ushort)descriptor.Width); writer.Write((ushort)descriptor.Width);
writer.Write((ushort)descriptor.Height); 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.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.SetBits(1, 3, descriptor.GlobalColorTableSize); // 2-4 : color resolution
field.SetBit(4, false); // 5 : GCT sort flag = 0 field.SetBit(4, false); // 5 : GCT sort flag = 0
@ -254,7 +254,7 @@ namespace ImageSharp.Formats
writer.Write(intro); writer.Write(intro);
PackedField field = new PackedField(); PackedField field = default(PackedField);
field.SetBits(3, 3, (int)extension.DisposalMethod); // 1-3 : Reserved, 4-6 : Disposal field.SetBits(3, 3, (int)extension.DisposalMethod); // 1-3 : Reserved, 4-6 : Disposal
// TODO: Allow this as an option. // TODO: Allow this as an option.
@ -285,7 +285,7 @@ namespace ImageSharp.Formats
writer.Write((ushort)image.Width); writer.Write((ushort)image.Width);
writer.Write((ushort)image.Height); 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(0, true); // 1: Local color table flag = 1 (LCT used)
field.SetBit(1, false); // 2: Interlace flag 0 field.SetBit(1, false); // 2: Interlace flag 0
field.SetBit(2, false); // 3: Sort flag 0 field.SetBit(2, false); // 3: Sort flag 0

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

@ -55,7 +55,7 @@ namespace ImageSharp.Formats
/// <returns>The <see cref="PackedField"/></returns> /// <returns>The <see cref="PackedField"/></returns>
public static PackedField FromInt(byte value) public static PackedField FromInt(byte value)
{ {
PackedField packed = new PackedField(); PackedField packed = default(PackedField);
packed.SetBits(0, 8, value); packed.SetBits(0, 8, value);
return packed; return packed;
} }

4
src/ImageSharp/Profiles/Exif/ExifReader.cs

@ -442,7 +442,7 @@ namespace ImageSharp
{ {
if (!this.ValidateArray(data, 8, 4)) if (!this.ValidateArray(data, 8, 4))
{ {
return new Rational(); return default(Rational);
} }
uint numerator = BitConverter.ToUInt32(data, 0); uint numerator = BitConverter.ToUInt32(data, 0);
@ -470,7 +470,7 @@ namespace ImageSharp
{ {
if (!this.ValidateArray(data, 8, 4)) if (!this.ValidateArray(data, 8, 4))
{ {
return new SignedRational(); return default(SignedRational);
} }
int numerator = BitConverter.ToInt32(data, 0); int numerator = BitConverter.ToInt32(data, 0);

2
src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs

@ -85,7 +85,7 @@ namespace ImageSharp.Processors
{ {
for (int x = startX; x < endX; x++) 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. // Apply each matrix multiplier to the color components for each pixel.
for (int fy = 0; fy < kernelHeight; fy++) for (int fy = 0; fy < kernelHeight; fy++)

Loading…
Cancel
Save