From ae00b2b4e15fa4748e27e839dd9266f4e4de4d24 Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Fri, 13 Apr 2018 17:11:58 -0700 Subject: [PATCH] Remove the intBuffer from PngEncoder --- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index 96c6a6650..892b00ea9 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -36,11 +36,6 @@ namespace SixLabors.ImageSharp.Formats.Png /// private readonly byte[] chunkDataBuffer = new byte[16]; - /// - /// Reusable buffer for writing int data. - /// - private readonly byte[] intBuffer = new byte[4]; - /// /// Reusable crc for validating chunks. /// @@ -442,7 +437,7 @@ namespace SixLabors.ImageSharp.Formats.Png // Get max colors for bit depth. int colorTableLength = (int)Math.Pow(2, header.BitDepth) * 3; - var rgba = default(Rgba32); + Rgba32 rgba = default; bool anyAlpha = false; using (IManagedByteBuffer colorTable = this.memoryManager.AllocateManagedByteBuffer(colorTableLength)) @@ -639,9 +634,9 @@ namespace SixLabors.ImageSharp.Formats.Png this.crc.Update(data.AsSpan(offset, length)); } - BinaryPrimitives.WriteUInt32BigEndian(this.intBuffer, (uint)this.crc.Value); + BinaryPrimitives.WriteUInt32BigEndian(this.buffer, (uint)this.crc.Value); - stream.Write(this.intBuffer, 0, 4); // write the crc + stream.Write(this.buffer, 0, 4); // write the crc } } } \ No newline at end of file