diff --git a/src/ImageSharp/Formats/IImageDecoder.cs b/src/ImageSharp/Formats/IImageDecoder.cs
index 86f4f3fa8a..3729c98d9b 100644
--- a/src/ImageSharp/Formats/IImageDecoder.cs
+++ b/src/ImageSharp/Formats/IImageDecoder.cs
@@ -27,7 +27,7 @@ public interface IImageDecoder
/// The token to monitor for cancellation requests.
/// The object.
/// Thrown if the encoded image contains errors.
- public Task IdentifyAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken);
+ public Task IdentifyAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default);
///
/// Decodes the image from the specified stream to an of a specific pixel type.
@@ -58,7 +58,7 @@ public interface IImageDecoder
/// The token to monitor for cancellation requests.
/// A representing the asynchronous operation.
/// Thrown if the encoded image contains errors.
- public Task> DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
+ public Task> DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)
where TPixel : unmanaged, IPixel;
///
@@ -69,5 +69,5 @@ public interface IImageDecoder
/// The token to monitor for cancellation requests.
/// A representing the asynchronous operation.
/// Thrown if the encoded image contains errors.
- public Task DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken);
+ public Task DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default);
}
diff --git a/src/ImageSharp/Formats/ISpecializedImageDecoder{T}.cs b/src/ImageSharp/Formats/ISpecializedImageDecoder{T}.cs
index 2bda864bc2..e9506795ce 100644
--- a/src/ImageSharp/Formats/ISpecializedImageDecoder{T}.cs
+++ b/src/ImageSharp/Formats/ISpecializedImageDecoder{T}.cs
@@ -41,7 +41,7 @@ public interface ISpecializedImageDecoder : IImageDecoder
/// The token to monitor for cancellation requests.
/// A representing the asynchronous operation.
/// Thrown if the encoded image contains errors.
- public Task> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken)
+ public Task> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken = default)
where TPixel : unmanaged, IPixel;
///
@@ -52,5 +52,5 @@ public interface ISpecializedImageDecoder : IImageDecoder
/// The token to monitor for cancellation requests.
/// A representing the asynchronous operation.
/// Thrown if the encoded image contains errors.
- public Task DecodeAsync(T options, Stream stream, CancellationToken cancellationToken);
+ public Task DecodeAsync(T options, Stream stream, CancellationToken cancellationToken = default);
}
diff --git a/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs b/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs
index f3e9c99172..fa6461464b 100644
--- a/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs
+++ b/src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs
@@ -30,7 +30,7 @@ public abstract class SpecializedImageDecoder : ImageDecoder, ISpecializedIma
s => this.Decode(options, s, default));
///
- public Task> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken)
+ public Task> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken = default)
where TPixel : unmanaged, IPixel
=> WithSeekableMemoryStreamAsync(
options.GeneralOptions,
@@ -39,7 +39,7 @@ public abstract class SpecializedImageDecoder : ImageDecoder, ISpecializedIma
cancellationToken);
///
- public Task DecodeAsync(T options, Stream stream, CancellationToken cancellationToken)
+ public Task DecodeAsync(T options, Stream stream, CancellationToken cancellationToken = default)
=> WithSeekableMemoryStreamAsync(
options.GeneralOptions,
stream,
diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs
index 4bd40dbcdf..2d66842e88 100644
--- a/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs
@@ -128,7 +128,7 @@ public class GifMetadataTests
var testFile = TestFile.Create(imagePath);
using var stream = new MemoryStream(testFile.Bytes, false);
var decoder = new GifDecoder();
- IImageInfo image = await decoder.IdentifyAsync(DecoderOptions.Default, stream, default);
+ IImageInfo image = await decoder.IdentifyAsync(DecoderOptions.Default, stream);
ImageMetadata meta = image.Metadata;
Assert.Equal(xResolution, meta.HorizontalResolution);
Assert.Equal(yResolution, meta.VerticalResolution);
@@ -156,7 +156,7 @@ public class GifMetadataTests
var testFile = TestFile.Create(imagePath);
using var stream = new MemoryStream(testFile.Bytes, false);
var decoder = new GifDecoder();
- using Image image = await decoder.DecodeAsync(DecoderOptions.Default, stream, default);
+ using Image image = await decoder.DecodeAsync(DecoderOptions.Default, stream);
ImageMetadata meta = image.Metadata;
Assert.Equal(xResolution, meta.HorizontalResolution);
Assert.Equal(yResolution, meta.VerticalResolution);
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
index ebcf9c8827..593b0f287d 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
@@ -106,7 +106,7 @@ public partial class JpegDecoderTests
var testFile = TestFile.Create(imagePath);
using var stream = new MemoryStream(testFile.Bytes, false);
var decoder = new JpegDecoder();
- IImageInfo image = await decoder.IdentifyAsync(DecoderOptions.Default, stream, default);
+ IImageInfo image = await decoder.IdentifyAsync(DecoderOptions.Default, stream);
ImageMetadata meta = image.Metadata;
Assert.Equal(xResolution, meta.HorizontalResolution);
Assert.Equal(yResolution, meta.VerticalResolution);
@@ -142,7 +142,7 @@ public partial class JpegDecoderTests
{
var testFile = TestFile.Create(imagePath);
using var stream = new MemoryStream(testFile.Bytes, false);
- using Image image = await JpegDecoder.DecodeAsync(DecoderOptions.Default, stream, default);
+ using Image image = await JpegDecoder.DecodeAsync(DecoderOptions.Default, stream);
JpegMetadata meta = image.Metadata.GetJpegMetadata();
Assert.Equal(quality, meta.Quality);
}
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
index 10126aab73..3285da31b4 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
@@ -213,7 +213,7 @@ public abstract partial class TestImageProvider : IXunitSerializable
// TODO: Check Path here. Why combined?
string path = Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, this.FilePath);
using Stream stream = System.IO.File.OpenRead(path);
- return await decoder.DecodeAsync(options, stream, default);
+ return await decoder.DecodeAsync(options, stream);
}
public override Image GetImage(ISpecializedImageDecoder decoder, T options)
@@ -250,7 +250,7 @@ public abstract partial class TestImageProvider : IXunitSerializable
// TODO: Check Path here. Why combined?
string path = Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, this.FilePath);
using Stream stream = System.IO.File.OpenRead(path);
- return await decoder.DecodeAsync(options, stream, default);
+ return await decoder.DecodeAsync(options, stream);
}
public override void Deserialize(IXunitSerializationInfo info)