Browse Source

Fix merge issues

pull/2899/head
James Jackson-South 3 months ago
parent
commit
6fcf75c5d9
  1. 9
      src/ImageSharp/Formats/Ani/AniDecoderCore.cs
  2. 13
      src/ImageSharp/Formats/Ani/AniFrameMetadata.cs
  3. 6
      src/ImageSharp/Formats/Ani/AniMetadata.cs
  4. 10
      src/ImageSharp/Formats/Webp/WebpConstants.cs

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

@ -78,6 +78,7 @@ internal class AniDecoderCore : ImageDecoderCore
{
case AniFrameFormat.Ico:
IcoFrameMetadata icoFrameMetadata = source.Metadata.GetIcoMetadata();
// TODO source.Metadata.SetFormatMetadata(IcoFormat.Instance, null);
clonedMetadata.IcoFrameMetadata = icoFrameMetadata;
clonedMetadata.EncodingWidth = icoFrameMetadata.EncodingWidth;
@ -85,6 +86,7 @@ internal class AniDecoderCore : ImageDecoderCore
break;
case AniFrameFormat.Cur:
CurFrameMetadata curFrameMetadata = source.Metadata.GetCurMetadata();
// TODO source.Metadata.SetFormatMetadata(CurFormat.Instance, null);
clonedMetadata.CurFrameMetadata = curFrameMetadata;
clonedMetadata.EncodingWidth = curFrameMetadata.EncodingWidth;
@ -198,6 +200,7 @@ internal class AniDecoderCore : ImageDecoderCore
{
case AniFrameFormat.Ico:
IcoFrameMetadata icoFrameMetadata = frameMetadata.GetIcoMetadata();
// TODO source.Metadata.SetFormatMetadata(IcoFormat.Instance, null);
clonedMetadata.IcoFrameMetadata = icoFrameMetadata;
clonedMetadata.EncodingWidth = icoFrameMetadata.EncodingWidth;
@ -205,6 +208,7 @@ internal class AniDecoderCore : ImageDecoderCore
break;
case AniFrameFormat.Cur:
CurFrameMetadata curFrameMetadata = frameMetadata.GetCurMetadata();
// TODO source.Metadata.SetFormatMetadata(CurFormat.Instance, null);
clonedMetadata.CurFrameMetadata = curFrameMetadata;
clonedMetadata.EncodingWidth = curFrameMetadata.EncodingWidth;
@ -218,8 +222,9 @@ internal class AniDecoderCore : ImageDecoderCore
return frameMetadata;
}));
}
else // BMP
else
{
// BMP
aniFrameMetadata.EncodingWidth = Narrow(info.Width);
aniFrameMetadata.EncodingHeight = Narrow(info.Height);
aniFrameMetadata.FrameFormat = type;
@ -253,6 +258,7 @@ internal class AniDecoderCore : ImageDecoderCore
switch (dir.Type)
{
// TODO: Use Core decoders.
case IconFileType.CUR:
info = CurDecoder.Instance.Identify(this.Options, this.currentStream);
type = AniFrameFormat.Cur;
@ -266,6 +272,7 @@ internal class AniDecoderCore : ImageDecoderCore
}
else
{
// TODO: Use Core decoders.
info = BmpDecoder.Instance.Identify(this.Options, this.currentStream);
type = AniFrameFormat.Bmp;
}

13
src/ImageSharp/Formats/Ani/AniFrameMetadata.cs

@ -1,7 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using SixLabors.ImageSharp.Formats.Cur;
using SixLabors.ImageSharp.Formats.Ico;
using SixLabors.ImageSharp.PixelFormats;
@ -68,12 +68,17 @@ public class AniFrameMetadata : IFormatFrameMetadata<AniFrameMetadata>
IDeepCloneable IDeepCloneable.DeepClone() => this.DeepClone();
/// <inheritdoc/>
public FormatConnectingFrameMetadata ToFormatConnectingFrameMetadata() => new FormatConnectingFrameMetadata() { Duration = TimeSpan.FromSeconds(this.FrameDelay / 60d) };
public FormatConnectingFrameMetadata ToFormatConnectingFrameMetadata()
{
// TODO: Implement. You need to consider encoding width/height.
return new() { Duration = TimeSpan.FromSeconds(this.FrameDelay / 60d) };
}
/// <inheritdoc/>
public void AfterFrameApply<TPixel>(ImageFrame<TPixel> source, ImageFrame<TPixel> destination)
public void AfterFrameApply<TPixel>(ImageFrame<TPixel> source, ImageFrame<TPixel> destination, Matrix4x4 matrix)
where TPixel : unmanaged, IPixel<TPixel>
{
// TODO: Implement. You need to consider encoding width/height.
}
/// <inheritdoc/>
@ -83,7 +88,7 @@ public class AniFrameMetadata : IFormatFrameMetadata<AniFrameMetadata>
EncodingHeight = this.EncodingHeight,
EncodingWidth = this.EncodingWidth,
SequenceNumber = this.SequenceNumber,
IsIco = this.IsIco,
FrameFormat = this.FrameFormat,
IcoFrameMetadata = this.IcoFrameMetadata?.DeepClone(),
CurFrameMetadata = this.CurFrameMetadata?.DeepClone(),

6
src/ImageSharp/Formats/Ani/AniMetadata.cs

@ -1,7 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata;
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Formats.Ani;
@ -75,8 +75,8 @@ public class AniMetadata : IFormatMetadata<AniMetadata>
=> throw new NotImplementedException();
/// <inheritdoc/>
public void AfterImageApply<TPixel>(Image<TPixel> destination)
where TPixel : unmanaged, IPixel<TPixel>
public void AfterImageApply<TPixel>(Image<TPixel> destination, Matrix4x4 matrix)
where TPixel : unmanaged, IPixel<TPixel>
{
}

10
src/ImageSharp/Formats/Webp/WebpConstants.cs

@ -60,11 +60,6 @@ internal static class WebpConstants
0x50 // P
];
/// <summary>
/// The header bytes identifying a Webp.
/// </summary>
public const string WebpFourCc = "WEBP";
/// <summary>
/// 3 bits reserved for version.
/// </summary>
@ -324,4 +319,9 @@ internal static class WebpConstants
-7, 8,
-8, -9
];
/// <summary>
/// Gets the header bytes identifying a Webp.
/// </summary>
public static ReadOnlySpan<byte> WebpFormTypeFourCc => "WEBP"u8;
}

Loading…
Cancel
Save