From 35d1473d7adc7fa16cad589e73da55e294edc35e Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Sat, 7 May 2022 19:11:23 +0200 Subject: [PATCH] Use const color profile name --- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index 8663915279..e5b49c41d3 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -90,7 +90,7 @@ namespace SixLabors.ImageSharp.Formats.Png /// /// The color profile name. /// - private const string ProfileName = "ICC Profile"; + private const string ColorProfileName = "ICC Profile"; /// /// Initializes a new instance of the class. @@ -718,16 +718,15 @@ namespace SixLabors.ImageSharp.Formats.Png return; } - string profileName = "ICC Profile"; byte[] iccProfileBytes = metaData.IccProfile.ToByteArray(); byte[] compressedData = this.GetZlibCompressedBytes(iccProfileBytes); - int payloadLength = profileName.Length + compressedData.Length + 2; + int payloadLength = ColorProfileName.Length + compressedData.Length + 2; using (IMemoryOwner owner = this.memoryAllocator.Allocate(payloadLength)) { Span outputBytes = owner.GetSpan(); - PngConstants.Encoding.GetBytes(profileName).CopyTo(outputBytes); - int bytesWritten = profileName.Length; + PngConstants.Encoding.GetBytes(ColorProfileName).CopyTo(outputBytes); + int bytesWritten = ColorProfileName.Length; outputBytes[bytesWritten++] = 0; // Null separator. outputBytes[bytesWritten++] = 0; // Compression. compressedData.CopyTo(outputBytes.Slice(bytesWritten));