Browse Source

Define componentId's as static readonly array's

pull/1734/head
Brian Popow 5 years ago
parent
commit
96edc48fbf
  1. 14
      src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs

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

@ -33,6 +33,16 @@ 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>
@ -148,10 +158,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
{
if (this.colorType == JpegColorType.Rgb)
{
return new byte[] { 82, 71, 66 };
return RgbComponentIds;
}
return new byte[] { 1, 2, 3 };
return DefaultComponentIds;
}
/// <summary>

Loading…
Cancel
Save