Browse Source

Change GetComponentIds as suggested by review

pull/1734/head
Brian Popow 5 years ago
parent
commit
f39702f676
  1. 22
      src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs

22
src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs

@ -33,16 +33,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
/// </summary>
private readonly byte[] buffer = new byte[20];
/// <summary>
/// The default component id's.
/// </summary>
private static readonly byte[] DefaultComponentIds = { 1, 2, 3 };
/// <summary>
/// Component id's for RGB colorspace.
/// </summary>
private static readonly byte[] RgbComponentIds = { 82, 71, 66 };
/// <summary>
/// The quality, that will be used to encode the image.
/// </summary>
@ -191,15 +181,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
/// For color space RGB this will be RGB as ASCII, otherwise 1, 2, 3.
/// </summary>
/// <returns>The component Ids.</returns>
private ReadOnlySpan<byte> GetComponentIds()
{
if (this.colorType == JpegColorType.Rgb)
{
return RgbComponentIds;
}
return DefaultComponentIds;
}
private ReadOnlySpan<byte> GetComponentIds() => this.colorType == JpegColorType.Rgb
? new ReadOnlySpan<byte>(new byte[] { 82, 71, 66 })
: new ReadOnlySpan<byte>(new byte[] { 1, 2, 3 });
/// <summary>
/// Writes data to "Define Quantization Tables" block for QuantIndex.

Loading…
Cancel
Save