From f39702f676d8ca5f5a9f466969c47f6ee992f655 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Mon, 16 Aug 2021 17:33:38 +0200 Subject: [PATCH] Change GetComponentIds as suggested by review --- .../Formats/Jpeg/JpegEncoderCore.cs | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs index 48b7d267a9..b7a3680064 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs @@ -33,16 +33,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg /// private readonly byte[] buffer = new byte[20]; - /// - /// The default component id's. - /// - private static readonly byte[] DefaultComponentIds = { 1, 2, 3 }; - - /// - /// Component id's for RGB colorspace. - /// - private static readonly byte[] RgbComponentIds = { 82, 71, 66 }; - /// /// The quality, that will be used to encode the image. /// @@ -191,15 +181,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg /// For color space RGB this will be RGB as ASCII, otherwise 1, 2, 3. /// /// The component Ids. - private ReadOnlySpan GetComponentIds() - { - if (this.colorType == JpegColorType.Rgb) - { - return RgbComponentIds; - } - - return DefaultComponentIds; - } + private ReadOnlySpan GetComponentIds() => this.colorType == JpegColorType.Rgb + ? new ReadOnlySpan(new byte[] { 82, 71, 66 }) + : new ReadOnlySpan(new byte[] { 1, 2, 3 }); /// /// Writes data to "Define Quantization Tables" block for QuantIndex.