Browse Source

Rename method

pull/2301/head
James Jackson-South 4 years ago
parent
commit
47f1cdab65
  1. 8
      src/ImageSharp/Formats/ImageDecoder.cs
  2. 4
      src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs

8
src/ImageSharp/Formats/ImageDecoder.cs

@ -31,7 +31,7 @@ public abstract class ImageDecoder : IImageDecoder
/// <inheritdoc/> /// <inheritdoc/>
public Task<Image<TPixel>> DecodeAsync<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default) public Task<Image<TPixel>> DecodeAsync<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
=> WithSeekableStreamAsync( => WithSeekableMemoryStreamAsync(
options, options,
stream, stream,
(s, ct) => this.Decode<TPixel>(options, s, ct), (s, ct) => this.Decode<TPixel>(options, s, ct),
@ -39,7 +39,7 @@ public abstract class ImageDecoder : IImageDecoder
/// <inheritdoc/> /// <inheritdoc/>
public Task<Image> DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default) public Task<Image> DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)
=> WithSeekableStreamAsync( => WithSeekableMemoryStreamAsync(
options, options,
stream, stream,
(s, ct) => this.Decode(options, s, ct), (s, ct) => this.Decode(options, s, ct),
@ -54,7 +54,7 @@ public abstract class ImageDecoder : IImageDecoder
/// <inheritdoc/> /// <inheritdoc/>
public Task<IImageInfo> IdentifyAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default) public Task<IImageInfo> IdentifyAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)
=> WithSeekableStreamAsync( => WithSeekableMemoryStreamAsync(
options, options,
stream, stream,
(s, ct) => this.Identify(options, s, ct), (s, ct) => this.Identify(options, s, ct),
@ -181,7 +181,7 @@ public abstract class ImageDecoder : IImageDecoder
return action(memoryStream); return action(memoryStream);
} }
internal static async Task<T> WithSeekableStreamAsync<T>( internal static async Task<T> WithSeekableMemoryStreamAsync<T>(
DecoderOptions options, DecoderOptions options,
Stream stream, Stream stream,
Func<Stream, CancellationToken, T> action, Func<Stream, CancellationToken, T> action,

4
src/ImageSharp/Formats/SpecializedImageDecoder{T}.cs

@ -32,7 +32,7 @@ public abstract class SpecializedImageDecoder<T> : ImageDecoder, ISpecializedIma
/// <inheritdoc/> /// <inheritdoc/>
public Task<Image<TPixel>> DecodeAsync<TPixel>(T options, Stream stream, CancellationToken cancellationToken) public Task<Image<TPixel>> DecodeAsync<TPixel>(T options, Stream stream, CancellationToken cancellationToken)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
=> WithSeekableStreamAsync( => WithSeekableMemoryStreamAsync(
options.GeneralOptions, options.GeneralOptions,
stream, stream,
(s, ct) => this.Decode<TPixel>(options, s, ct), (s, ct) => this.Decode<TPixel>(options, s, ct),
@ -40,7 +40,7 @@ public abstract class SpecializedImageDecoder<T> : ImageDecoder, ISpecializedIma
/// <inheritdoc/> /// <inheritdoc/>
public Task<Image> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken) public Task<Image> DecodeAsync(T options, Stream stream, CancellationToken cancellationToken)
=> WithSeekableStreamAsync( => WithSeekableMemoryStreamAsync(
options.GeneralOptions, options.GeneralOptions,
stream, stream,
(s, ct) => this.Decode(options, s, ct), (s, ct) => this.Decode(options, s, ct),

Loading…
Cancel
Save