Skip to content

Commit b61c214

Browse files
Merge pull request #1 from dlemstra/StyleCop
StyleCop
2 parents 776cf3e + 3c026f7 commit b61c214

26 files changed

+77
-61
lines changed

src/ImageSharp/Common/Helpers/ImageMaths.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ public static Rectangle GetFilteredBoundingRectangle<TColor, TPacked>(ImageBase<
171171
const float Epsilon = .00001f;
172172
int width = bitmap.Width;
173173
int height = bitmap.Height;
174-
Point topLeft = new Point();
175-
Point bottomRight = new Point();
174+
Point topLeft = default(Point);
175+
Point bottomRight = default(Point);
176176

177177
Func<PixelAccessor<TColor, TPacked>, int, int, float, bool> delegateFunc;
178178

src/ImageSharp/Filters/Processors/IImageFilter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
namespace ImageSharp.Processors
1+
// <copyright file="IImageFilter.cs" company="James Jackson-South">
2+
// Copyright (c) James Jackson-South and contributors.
3+
// Licensed under the Apache License, Version 2.0.
4+
// </copyright>
5+
6+
namespace ImageSharp.Processors
27
{
38
/// <summary>
49
/// Encapsulates methods to alter the pixels of an image. The processor operates on the original source pixels.

src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private void ReadRgb16<TColor, TPacked>(TColor[] imageData, int width, int heigh
290290
byte g = (byte)(((temp & Rgb16GMask) >> 5) * ScaleG);
291291
byte b = (byte)((temp & Rgb16BMask) * ScaleR);
292292

293-
int arrayOffset = ((row * width) + x);
293+
int arrayOffset = (row * width) + x;
294294

295295
// Stored in b-> g-> r order.
296296
TColor packed = default(TColor);
@@ -330,7 +330,7 @@ private void ReadRgb24<TColor, TPacked>(TColor[] imageData, int width, int heigh
330330
for (int x = 0; x < width; x++)
331331
{
332332
int offset = rowOffset + (x * 3);
333-
int arrayOffset = ((row * width) + x);
333+
int arrayOffset = (row * width) + x;
334334

335335
// Stored in b-> g-> r-> a order.
336336
TColor packed = default(TColor);
@@ -370,7 +370,7 @@ private void ReadRgb32<TColor, TPacked>(TColor[] imageData, int width, int heigh
370370
for (int x = 0; x < width; x++)
371371
{
372372
int offset = rowOffset + (x * 4);
373-
int arrayOffset = ((row * width) + x);
373+
int arrayOffset = (row * width) + x;
374374

375375
// Stored in b-> g-> r-> a order.
376376
TColor packed = default(TColor);

src/ImageSharp/Formats/Gif/GifEncoderCore.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private void WriteLogicalScreenDescriptor<TColor, TPacked>(Image<TColor, TPacked
168168
writer.Write((ushort)descriptor.Width);
169169
writer.Write((ushort)descriptor.Height);
170170

171-
PackedField field = new PackedField();
171+
PackedField field = default(PackedField);
172172
field.SetBit(0, descriptor.GlobalColorTableFlag); // 1 : Global color table flag = 1 || 0 (GCT used/ not used)
173173
field.SetBits(1, 3, descriptor.GlobalColorTableSize); // 2-4 : color resolution
174174
field.SetBit(4, false); // 5 : GCT sort flag = 0
@@ -254,7 +254,7 @@ private void WriteGraphicalControlExtension<TColor, TPacked>(ImageBase<TColor, T
254254

255255
writer.Write(intro);
256256

257-
PackedField field = new PackedField();
257+
PackedField field = default(PackedField);
258258
field.SetBits(3, 3, (int)extension.DisposalMethod); // 1-3 : Reserved, 4-6 : Disposal
259259

260260
// TODO: Allow this as an option.
@@ -285,7 +285,7 @@ private void WriteImageDescriptor<TColor, TPacked>(ImageBase<TColor, TPacked> im
285285
writer.Write((ushort)image.Width);
286286
writer.Write((ushort)image.Height);
287287

288-
PackedField field = new PackedField();
288+
PackedField field = default(PackedField);
289289
field.SetBit(0, true); // 1: Local color table flag = 1 (LCT used)
290290
field.SetBit(1, false); // 2: Interlace flag 0
291291
field.SetBit(2, false); // 3: Sort flag 0

src/ImageSharp/Formats/Gif/PackedField.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public byte Byte
5555
/// <returns>The <see cref="PackedField"/></returns>
5656
public static PackedField FromInt(byte value)
5757
{
58-
PackedField packed = new PackedField();
58+
PackedField packed = default(PackedField);
5959
packed.SetBits(0, 8, value);
6060
return packed;
6161
}

src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// Licensed under the Apache License, Version 2.0.
44
// </copyright>
55

6-
using System.Numerics;
7-
86
namespace ImageSharp.Formats
97
{
108
using System;
@@ -51,7 +49,8 @@ internal class JpegEncoderCore
5149
/// The values are derived from section K.1 after converting from natural to
5250
/// zig-zag order.
5351
/// </summary>
54-
private readonly byte[,] unscaledQuant = {
52+
private readonly byte[,] unscaledQuant =
53+
{
5554
{
5655
// Luminance.
5756
16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40,
@@ -73,7 +72,8 @@ internal class JpegEncoderCore
7372
/// The Huffman encoding specifications.
7473
/// This encoder uses the same Huffman encoding for all images.
7574
/// </summary>
76-
private readonly HuffmanSpec[] theHuffmanSpec = {
75+
private readonly HuffmanSpec[] theHuffmanSpec =
76+
{
7777
// Luminance DC.
7878
new HuffmanSpec(
7979
new byte[]
@@ -488,9 +488,9 @@ public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream,
488488
int componentCount = 3;
489489

490490
// Write the Start Of Image marker.
491-
WriteApplicationHeader((short)image.HorizontalResolution, (short)image.VerticalResolution);
491+
this.WriteApplicationHeader((short)image.HorizontalResolution, (short)image.VerticalResolution);
492492

493-
WriteProfiles(image);
493+
this.WriteProfiles(image);
494494

495495
// Write the quantization tables.
496496
this.WriteDQT();
@@ -574,7 +574,7 @@ private void WriteProfiles<TColor, TPacked>(Image<TColor, TPacked> image)
574574
where TColor : struct, IPackedPixel<TPacked>
575575
where TPacked : struct
576576
{
577-
WriteProfile(image.ExifProfile);
577+
this.WriteProfile(image.ExifProfile);
578578
}
579579

580580
private void WriteProfile(ExifProfile exifProfile)

src/ImageSharp/Formats/Png/PngEncoderCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ private void WriteGammaChunk(Stream stream)
611611
/// <param name="stream">The stream.</param>
612612
private void WriteDataChunks(Stream stream)
613613
{
614-
byte[] data = this.EncodePixelData();
614+
byte[] data = this.EncodePixelData();
615615

616616
byte[] buffer;
617617
int bufferLength;

src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ protected override void Dispose(bool disposing)
184184
this.deflateStream.Dispose();
185185
this.deflateStream = null;
186186
}
187-
else {
188-
187+
else
188+
{
189189
// Hack: empty input?
190190
this.rawStream.WriteByte(3);
191191
this.rawStream.WriteByte(0);
@@ -196,7 +196,7 @@ protected override void Dispose(bool disposing)
196196
this.rawStream.WriteByte((byte)((crc >> 24) & 0xFF));
197197
this.rawStream.WriteByte((byte)((crc >> 16) & 0xFF));
198198
this.rawStream.WriteByte((byte)((crc >> 8) & 0xFF));
199-
this.rawStream.WriteByte((byte)((crc) & 0xFF));
199+
this.rawStream.WriteByte((byte)(crc & 0xFF));
200200
}
201201

202202
base.Dispose(disposing);

src/ImageSharp/IO/EndianBinaryReader.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,7 @@ private void ReadInternal(byte[] data, int size)
575575
int read = this.BaseStream.Read(data, index, size - index);
576576
if (read == 0)
577577
{
578-
throw new EndOfStreamException
579-
(
578+
throw new EndOfStreamException(
580579
string.Format(
581580
"End of stream reached with {0} byte{1} left to read.",
582581
size - index,

src/ImageSharp/IO/EndianBitConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public static string ToString(byte[] value, int startIndex, int length)
325325
}
326326
#endregion
327327

328-
#region Decimal conversions
328+
#region Decimal conversions
329329
/// <summary>
330330
/// Returns a decimal value converted from sixteen bytes
331331
/// at a specified position in a byte array.

0 commit comments

Comments
 (0)