@@ -33,16 +33,6 @@ internal sealed unsafe class JpegEncoderCore : IImageEncoderInternals
3333 /// </summary>
3434 private readonly byte [ ] buffer = new byte [ 20 ] ;
3535
36- /// <summary>
37- /// The default component id's.
38- /// </summary>
39- private static readonly byte [ ] DefaultComponentIds = { 1 , 2 , 3 } ;
40-
41- /// <summary>
42- /// Component id's for RGB colorspace.
43- /// </summary>
44- private static readonly byte [ ] RgbComponentIds = { 82 , 71 , 66 } ;
45-
4636 /// <summary>
4737 /// The quality, that will be used to encode the image.
4838 /// </summary>
@@ -191,15 +181,9 @@ private static bool IsSupportedColorType(JpegColorType? colorType)
191181 /// For color space RGB this will be RGB as ASCII, otherwise 1, 2, 3.
192182 /// </summary>
193183 /// <returns>The component Ids.</returns>
194- private ReadOnlySpan < byte > GetComponentIds ( )
195- {
196- if ( this . colorType == JpegColorType . Rgb )
197- {
198- return RgbComponentIds ;
199- }
200-
201- return DefaultComponentIds ;
202- }
184+ private ReadOnlySpan < byte > GetComponentIds ( ) => this . colorType == JpegColorType . Rgb
185+ ? new ReadOnlySpan < byte > ( new byte [ ] { 82 , 71 , 66 } )
186+ : new ReadOnlySpan < byte > ( new byte [ ] { 1 , 2 , 3 } ) ;
203187
204188 /// <summary>
205189 /// Writes data to "Define Quantization Tables" block for QuantIndex.
0 commit comments