Browse Source

Fixed SA1127

pull/30/head
Dirk Lemstra 9 years ago
parent
commit
497939a69a
  1. 12
      src/ImageSharp/Formats/Png/PngDecoderCore.cs

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

@ -114,7 +114,8 @@ namespace ImageSharp.Formats
/// Thrown if the image is larger than the maximum allowable size.
/// </exception>
public void Decode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
Image<TColor, TPacked> currentImage = image;
this.currentStream = stream;
@ -194,7 +195,8 @@ namespace ImageSharp.Formats
/// <param name="image">The image to read to.</param>
/// <param name="data">The data containing physical data.</param>
private void ReadPhysicalChunk<TColor, TPacked>(Image<TColor, TPacked> image, byte[] data)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
data.ReverseBytes(0, 4);
data.ReverseBytes(4, 4);
@ -255,7 +257,8 @@ namespace ImageSharp.Formats
/// <param name="dataStream">The <see cref="MemoryStream"/> containing data.</param>
/// <param name="pixels"> The pixel data.</param>
private void ReadScanlines<TColor, TPacked>(MemoryStream dataStream, PixelAccessor<TColor, TPacked> pixels)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
this.bytesPerPixel = this.CalculateBytesPerPixel();
this.bytesPerScanline = this.CalculateScanlineLength() + 1;
@ -280,7 +283,8 @@ namespace ImageSharp.Formats
/// <param name="compressedStream">The compressed pixel data stream.</param>
/// <param name="pixels">The image pixel accessor.</param>
private void DecodePixelData<TColor, TPacked>(Stream compressedStream, PixelAccessor<TColor, TPacked> pixels)
where TColor : struct, IPackedPixel<TPacked> where TPacked : struct
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
byte[] previousScanline = ArrayPool<byte>.Shared.Rent(this.bytesPerScanline);
byte[] scanline = ArrayPool<byte>.Shared.Rent(this.bytesPerScanline);

Loading…
Cancel
Save