Skip to content

Commit dc6871c

Browse files
Add explicit AOT seeding for SpectralConverter
1 parent e61585a commit dc6871c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/ImageSharp/Advanced/AotCompilerTools.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
using SixLabors.ImageSharp.Formats.Gif;
1111
using SixLabors.ImageSharp.Formats.Jpeg;
1212
using SixLabors.ImageSharp.Formats.Jpeg.Components;
13+
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder;
1314
using SixLabors.ImageSharp.Formats.Pbm;
1415
using SixLabors.ImageSharp.Formats.Png;
1516
using SixLabors.ImageSharp.Formats.Qoi;
1617
using SixLabors.ImageSharp.Formats.Tga;
1718
using SixLabors.ImageSharp.Formats.Tiff;
19+
using SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors;
1820
using SixLabors.ImageSharp.Formats.Webp;
1921
using SixLabors.ImageSharp.Memory;
2022
using SixLabors.ImageSharp.PixelFormats;
@@ -130,6 +132,7 @@ private static void Seed<TPixel>()
130132
AotCompileImageDecoderInternals<TPixel>();
131133
AotCompileImageEncoders<TPixel>();
132134
AotCompileImageDecoders<TPixel>();
135+
AotCompileSpectralConverter<TPixel>();
133136
AotCompileImageProcessors<TPixel>();
134137
AotCompileGenericImageProcessors<TPixel>();
135138
AotCompileResamplers<TPixel>();
@@ -269,6 +272,17 @@ private static void AotCompileImageDecoders<TPixel>()
269272
AotCompileImageDecoder<TPixel, TiffDecoder>();
270273
}
271274

275+
[Preserve]
276+
private static void AotCompileSpectralConverter<TPixel>()
277+
where TPixel : unmanaged, IPixel<TPixel>
278+
{
279+
default(SpectralConverter<TPixel>).GetPixelBuffer(default);
280+
default(GrayJpegSpectralConverter<TPixel>).GetPixelBuffer(default);
281+
default(RgbJpegSpectralConverter<TPixel>).GetPixelBuffer(default);
282+
default(TiffJpegSpectralConverter<TPixel>).GetPixelBuffer(default);
283+
default(TiffOldJpegSpectralConverter<TPixel>).GetPixelBuffer(default);
284+
}
285+
272286
/// <summary>
273287
/// This method pre-seeds the <see cref="IImageEncoder"/> in the AoT compiler.
274288
/// </summary>

0 commit comments

Comments
 (0)