diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs
index 9e7624480..9f20704cf 100644
--- a/src/ImageSharp/Advanced/AotCompilerTools.cs
+++ b/src/ImageSharp/Advanced/AotCompilerTools.cs
@@ -1,6 +1,9 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
+using System.Numerics;
+using SixLabors.ImageSharp.Formats;
+using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
@@ -15,6 +18,20 @@ namespace SixLabors.ImageSharp.Advanced
///
public static class AotCompilerTools
{
+ ///
+ /// Seeds the calls.
+ ///
+ public static void SeedUnsafe()
+ {
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+ }
+
///
/// Seeds the compiler using the given pixel format.
///
@@ -27,6 +44,13 @@ namespace SixLabors.ImageSharp.Advanced
AotCompileWuQuantizer();
AotCompileDithering();
+ System.Runtime.CompilerServices.Unsafe.SizeOf();
+
+ AotDecoder(new Formats.Png.PngDecoder());
+ AotDecoder(new Formats.Bmp.BmpDecoder());
+ AotDecoder(new Formats.Gif.GifDecoder());
+ AotDecoder(new Formats.Jpeg.JpegDecoder());
+
// TODO: Do the discovery work to figure out what works and what doesn't.
}
@@ -99,5 +123,22 @@ namespace SixLabors.ImageSharp.Advanced
TPixel pixel = default;
test.Dither(new ImageFrame(Configuration.Default, 1, 1), pixel, pixel, 0, 0, 0, 0, 0, 0);
}
+
+ ///
+ /// This method pre-seeds the decoder for a given pixel format in the AoT compiler for iOS.
+ ///
+ /// The image decoder to seed..
+ /// The pixel format.
+ private static void AotDecoder(IImageDecoder decoder)
+ where TPixel : struct, IPixel
+ {
+ try
+ {
+ decoder.Decode(Configuration.Default, null);
+ }
+ catch
+ {
+ }
+ }
}
}
\ No newline at end of file