Poker
1 year ago
No known key found for this signature in database
GPG Key ID: C65A6AD457D5C8F8
2 changed files with
17 additions and
6 deletions
-
src/ImageSharp/Formats/Ani/AniDecoderCore.cs
-
src/ImageSharp/Formats/Icon/IconDir.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, |
|
|
|
|
|
|
|
@ -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)); |
|
|
|
|
|
|
|
|