Browse Source

Minor StyleCop adjustments

pull/33/head
James Jackson-South 10 years ago
parent
commit
3e29b8fa0d
  1. 2
      src/ImageSharp/Formats/Gif/GifDecoderCore.cs
  2. 12
      src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
  3. 28
      src/ImageSharp/Image/PixelAccessor.cs

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

@ -322,7 +322,7 @@ namespace ImageSharp.Formats
image = currentFrame; image = currentFrame;
RestoreToBackground(image); this.RestoreToBackground(image);
this.decodedImage.Frames.Add(currentFrame); this.decodedImage.Frames.Add(currentFrame);
} }

12
src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs

@ -209,7 +209,6 @@ namespace ImageSharp.Formats
this.bytes = Bytes.Create(); this.bytes = Bytes.Create();
// TODO: This looks like it could be static. // TODO: This looks like it could be static.
for (int i = 0; i < MaxTc + 1; i++) for (int i = 0; i < MaxTc + 1; i++)
{ {
for (int j = 0; j < MaxTh + 1; j++) for (int j = 0; j < MaxTh + 1; j++)
@ -229,7 +228,8 @@ namespace ImageSharp.Formats
/// <param name="stream">The stream, where the image should be.</param> /// <param name="stream">The stream, where the image should be.</param>
/// <param name="configOnly">Whether to decode metadata only.</param> /// <param name="configOnly">Whether to decode metadata only.</param>
public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream, bool configOnly) public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream, bool configOnly)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{ {
this.inputStream = stream; this.inputStream = stream;
@ -287,7 +287,7 @@ namespace ImageSharp.Formats
break; break;
} }
if (JpegConstants.Markers.RST0 <= marker && marker <= JpegConstants.Markers.RST7) if (marker >= JpegConstants.Markers.RST0 && marker <= JpegConstants.Markers.RST7)
{ {
// Figures B.2 and B.16 of the specification suggest that restart markers should // Figures B.2 and B.16 of the specification suggest that restart markers should
// only occur between Entropy Coded Segments and not after the final ECS. // only occur between Entropy Coded Segments and not after the final ECS.
@ -336,7 +336,11 @@ namespace ImageSharp.Formats
{ {
this.Skip(remaining); this.Skip(remaining);
} }
else this.ProcessDqt(remaining); else
{
this.ProcessDqt(remaining);
}
break; break;
case JpegConstants.Markers.SOS: case JpegConstants.Markers.SOS:
if (configOnly) if (configOnly)

28
src/ImageSharp/Image/PixelAccessor.cs

@ -120,20 +120,6 @@ namespace ImageSharp
} }
} }
[Conditional("DEBUG")]
private void CheckCoordinates(int x, int y)
{
if (x < 0 || x >= this.Width)
{
throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds.");
}
if (y < 0 || y >= this.Height)
{
throw new ArgumentOutOfRangeException(nameof(y), y, $"{y} is outwith the image bounds.");
}
}
/// <summary> /// <summary>
/// Copies a block of pixels at the specified position. /// Copies a block of pixels at the specified position.
/// </summary> /// </summary>
@ -433,5 +419,19 @@ namespace ImageSharp
{ {
return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf<TColor>()); return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf<TColor>());
} }
[Conditional("DEBUG")]
private void CheckCoordinates(int x, int y)
{
if (x < 0 || x >= this.Width)
{
throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds.");
}
if (y < 0 || y >= this.Height)
{
throw new ArgumentOutOfRangeException(nameof(y), y, $"{y} is outwith the image bounds.");
}
}
} }
} }
Loading…
Cancel
Save