Browse Source

fix primary ctor

pull/2899/head
Poker 1 year ago
parent
commit
fc9fdee0ac
No known key found for this signature in database GPG Key ID: C65A6AD457D5C8F8
  1. 8
      src/ImageSharp/Formats/Ani/AniDecoderCore.cs
  2. 15
      src/ImageSharp/Formats/Icon/IconDir.cs

8
src/ImageSharp/Formats/Ani/AniDecoderCore.cs

@ -18,12 +18,12 @@ using SixLabors.ImageSharp.Metadata;
namespace SixLabors.ImageSharp.Formats.Ani;
internal class AniDecoderCore(DecoderOptions options) : ImageDecoderCore(options)
internal class AniDecoderCore : ImageDecoderCore
{
/// <summary>
/// The general decoder options.
/// </summary>
private readonly Configuration configuration = options.Configuration;
private readonly Configuration configuration;
/// <summary>
/// The stream to decode from.
@ -32,6 +32,10 @@ internal class AniDecoderCore(DecoderOptions options) : ImageDecoderCore(options
private AniHeader header;
public AniDecoderCore(DecoderOptions options)
: base(options) =>
this.configuration = options.Configuration;
private enum ListIconChunkType : byte
{
Ico = 1,

15
src/ImageSharp/Formats/Icon/IconDir.cs

@ -7,30 +7,37 @@ using System.Runtime.InteropServices;
namespace SixLabors.ImageSharp.Formats.Icon;
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = Size)]
internal struct IconDir(ushort reserved, IconFileType type, ushort count)
internal struct IconDir
{
public const int Size = 3 * sizeof(ushort);
/// <summary>
/// Reserved. Must always be 0.
/// </summary>
public ushort Reserved = reserved;
public ushort Reserved;
/// <summary>
/// Specifies image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid.
/// </summary>
public IconFileType Type = type;
public IconFileType Type;
/// <summary>
/// Specifies number of images in the file.
/// </summary>
public ushort Count = count;
public ushort Count;
public IconDir(IconFileType type, ushort count = 0)
: this(0, type, count)
{
}
public IconDir(ushort reserved, IconFileType type, ushort count)
{
this.Reserved = reserved;
this.Type = type;
this.Count = count;
}
public static ref IconDir Parse(ReadOnlySpan<byte> data)
=> ref Unsafe.As<byte, IconDir>(ref MemoryMarshal.GetReference(data));

Loading…
Cancel
Save