Skip to content

Commit 3b46ce1

Browse files
committed
merge
2 parents a34bca3 + 5c28129 commit 3b46ce1

File tree

293 files changed

+5686
-3256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+5686
-3256
lines changed

src/ImageSharp/Advanced/AotCompilerTools.cs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +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;
16+
using SixLabors.ImageSharp.Formats.Qoi;
1517
using SixLabors.ImageSharp.Formats.Tga;
1618
using SixLabors.ImageSharp.Formats.Tiff;
19+
using SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors;
1720
using SixLabors.ImageSharp.Formats.Webp;
1821
using SixLabors.ImageSharp.Memory;
1922
using SixLabors.ImageSharp.PixelFormats;
@@ -129,6 +132,7 @@ private static void Seed<TPixel>()
129132
AotCompileImageDecoderInternals<TPixel>();
130133
AotCompileImageEncoders<TPixel>();
131134
AotCompileImageDecoders<TPixel>();
135+
AotCompileSpectralConverter<TPixel>();
132136
AotCompileImageProcessors<TPixel>();
133137
AotCompileGenericImageProcessors<TPixel>();
134138
AotCompileResamplers<TPixel>();
@@ -195,39 +199,41 @@ private static void AotCompileImageProcessingContextFactory<TPixel>()
195199
=> default(DefaultImageOperationsProviderFactory).CreateImageProcessingContext<TPixel>(default, default, default);
196200

197201
/// <summary>
198-
/// This method pre-seeds the all <see cref="IImageEncoderInternals"/> in the AoT compiler.
202+
/// This method pre-seeds the all core encoders in the AoT compiler.
199203
/// </summary>
200204
/// <typeparam name="TPixel">The pixel format.</typeparam>
201205
[Preserve]
202206
private static void AotCompileImageEncoderInternals<TPixel>()
203207
where TPixel : unmanaged, IPixel<TPixel>
204208
{
205-
default(WebpEncoderCore).Encode<TPixel>(default, default, default);
206209
default(BmpEncoderCore).Encode<TPixel>(default, default, default);
207210
default(GifEncoderCore).Encode<TPixel>(default, default, default);
208211
default(JpegEncoderCore).Encode<TPixel>(default, default, default);
209212
default(PbmEncoderCore).Encode<TPixel>(default, default, default);
210213
default(PngEncoderCore).Encode<TPixel>(default, default, default);
214+
default(QoiEncoderCore).Encode<TPixel>(default, default, default);
211215
default(TgaEncoderCore).Encode<TPixel>(default, default, default);
212216
default(TiffEncoderCore).Encode<TPixel>(default, default, default);
217+
default(WebpEncoderCore).Encode<TPixel>(default, default, default);
213218
}
214219

215220
/// <summary>
216-
/// This method pre-seeds the all <see cref="IImageDecoderInternals"/> in the AoT compiler.
221+
/// This method pre-seeds the all <see cref="ImageDecoderCore"/> in the AoT compiler.
217222
/// </summary>
218223
/// <typeparam name="TPixel">The pixel format.</typeparam>
219224
[Preserve]
220225
private static void AotCompileImageDecoderInternals<TPixel>()
221226
where TPixel : unmanaged, IPixel<TPixel>
222227
{
223-
default(WebpDecoderCore).Decode<TPixel>(default, default);
224-
default(BmpDecoderCore).Decode<TPixel>(default, default);
225-
default(GifDecoderCore).Decode<TPixel>(default, default);
226-
default(JpegDecoderCore).Decode<TPixel>(default, default);
227-
default(PbmDecoderCore).Decode<TPixel>(default, default);
228-
default(PngDecoderCore).Decode<TPixel>(default, default);
229-
default(TgaDecoderCore).Decode<TPixel>(default, default);
230-
default(TiffDecoderCore).Decode<TPixel>(default, default);
228+
default(BmpDecoderCore).Decode<TPixel>(default, default, default);
229+
default(GifDecoderCore).Decode<TPixel>(default, default, default);
230+
default(JpegDecoderCore).Decode<TPixel>(default, default, default);
231+
default(PbmDecoderCore).Decode<TPixel>(default, default, default);
232+
default(PngDecoderCore).Decode<TPixel>(default, default, default);
233+
default(QoiDecoderCore).Decode<TPixel>(default, default, default);
234+
default(TgaDecoderCore).Decode<TPixel>(default, default, default);
235+
default(TiffDecoderCore).Decode<TPixel>(default, default, default);
236+
default(WebpDecoderCore).Decode<TPixel>(default, default, default);
231237
}
232238

233239
/// <summary>
@@ -266,6 +272,17 @@ private static void AotCompileImageDecoders<TPixel>()
266272
AotCompileImageDecoder<TPixel, TiffDecoder>();
267273
}
268274

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+
269286
/// <summary>
270287
/// This method pre-seeds the <see cref="IImageEncoder"/> in the AoT compiler.
271288
/// </summary>

src/ImageSharp/Formats/AnimatedImageFrameMetadata.cs

Lines changed: 0 additions & 94 deletions
This file was deleted.

src/ImageSharp/Formats/AnimatedImageMetadata.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/ImageSharp/Formats/Bmp/BmpBitsPerPixel.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,35 @@ public enum BmpBitsPerPixel : short
1111
/// <summary>
1212
/// 1 bit per pixel.
1313
/// </summary>
14-
Pixel1 = 1,
14+
Bit1 = 1,
1515

1616
/// <summary>
1717
/// 2 bits per pixel.
1818
/// </summary>
19-
Pixel2 = 2,
19+
Bit2 = 2,
2020

2121
/// <summary>
2222
/// 4 bits per pixel.
2323
/// </summary>
24-
Pixel4 = 4,
24+
Bit4 = 4,
2525

2626
/// <summary>
2727
/// 8 bits per pixel. Each pixel consists of 1 byte.
2828
/// </summary>
29-
Pixel8 = 8,
29+
Bit8 = 8,
3030

3131
/// <summary>
3232
/// 16 bits per pixel. Each pixel consists of 2 bytes.
3333
/// </summary>
34-
Pixel16 = 16,
34+
Bit16 = 16,
3535

3636
/// <summary>
3737
/// 24 bits per pixel. Each pixel consists of 3 bytes.
3838
/// </summary>
39-
Pixel24 = 24,
39+
Bit24 = 24,
4040

4141
/// <summary>
4242
/// 32 bits per pixel. Each pixel consists of 4 bytes.
4343
/// </summary>
44-
Pixel32 = 32
44+
Bit32 = 32
4545
}

src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp;
2222
/// <remarks>
2323
/// A useful decoding source example can be found at <see href="https://dxr.mozilla.org/mozilla-central/source/image/decoders/nsBMPDecoder.cpp"/>
2424
/// </remarks>
25-
internal sealed class BmpDecoderCore : IImageDecoderInternals
25+
internal sealed class BmpDecoderCore : ImageDecoderCore
2626
{
2727
/// <summary>
2828
/// The default mask for the red part of the color for 16 bit rgb bitmaps.
@@ -114,8 +114,8 @@ internal sealed class BmpDecoderCore : IImageDecoderInternals
114114
/// </summary>
115115
/// <param name="options">The options.</param>
116116
public BmpDecoderCore(BmpDecoderOptions options)
117+
: base(options.GeneralOptions)
117118
{
118-
this.Options = options.GeneralOptions;
119119
this.rleSkippedPixelHandling = options.RleSkippedPixelHandling;
120120
this.configuration = options.GeneralOptions.Configuration;
121121
this.memoryAllocator = this.configuration.MemoryAllocator;
@@ -125,14 +125,7 @@ public BmpDecoderCore(BmpDecoderOptions options)
125125
}
126126

127127
/// <inheritdoc />
128-
public DecoderOptions Options { get; }
129-
130-
/// <inheritdoc />
131-
public Size Dimensions => new(this.infoHeader.Width, this.infoHeader.Height);
132-
133-
/// <inheritdoc />
134-
public Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken cancellationToken)
135-
where TPixel : unmanaged, IPixel<TPixel>
128+
protected override Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken cancellationToken)
136129
{
137130
Image<TPixel>? image = null;
138131
try
@@ -224,10 +217,10 @@ public Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken
224217
}
225218

226219
/// <inheritdoc />
227-
public ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken)
220+
protected override ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken)
228221
{
229222
this.ReadImageHeaders(stream, out _, out _);
230-
return new ImageInfo(new PixelTypeInfo(this.infoHeader.BitsPerPixel), new(this.infoHeader.Width, this.infoHeader.Height), this.metadata);
223+
return new ImageInfo(new(this.infoHeader.Width, this.infoHeader.Height), this.metadata);
231224
}
232225

233226
/// <summary>
@@ -1463,6 +1456,8 @@ private void ReadInfoHeader(BufferedReadStream stream)
14631456
this.bmpMetadata = this.metadata.GetBmpMetadata();
14641457
this.bmpMetadata.InfoHeaderType = infoHeaderType;
14651458
this.bmpMetadata.BitsPerPixel = (BmpBitsPerPixel)bitsPerPixel;
1459+
1460+
this.Dimensions = new(this.infoHeader.Width, this.infoHeader.Height);
14661461
}
14671462

14681463
/// <summary>

src/ImageSharp/Formats/Bmp/BmpEncoder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
33

4-
using SixLabors.ImageSharp.Advanced;
54
using SixLabors.ImageSharp.Processing;
65

76
namespace SixLabors.ImageSharp.Formats.Bmp;

0 commit comments

Comments
 (0)