@@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp.Formats.Webp;
88/// <summary>
99/// Image decoder for generating an image out of a webp stream.
1010/// </summary>
11- public sealed class WebpDecoder : ImageDecoder
11+ public sealed class WebpDecoder : SpecializedImageDecoder < WebpDecoderOptions >
1212{
1313 private WebpDecoder ( )
1414 {
@@ -25,25 +25,33 @@ protected override ImageInfo Identify(DecoderOptions options, Stream stream, Can
2525 Guard . NotNull ( options , nameof ( options ) ) ;
2626 Guard . NotNull ( stream , nameof ( stream ) ) ;
2727
28- using WebpDecoderCore decoder = new ( options ) ;
28+ using WebpDecoderCore decoder = new ( new WebpDecoderOptions ( ) { GeneralOptions = options } ) ;
2929 return decoder . Identify ( options . Configuration , stream , cancellationToken ) ;
3030 }
3131
3232 /// <inheritdoc/>
33- protected override Image < TPixel > Decode < TPixel > ( DecoderOptions options , Stream stream , CancellationToken cancellationToken )
33+ protected override Image < TPixel > Decode < TPixel > ( WebpDecoderOptions options , Stream stream , CancellationToken cancellationToken )
3434 {
3535 Guard . NotNull ( options , nameof ( options ) ) ;
3636 Guard . NotNull ( stream , nameof ( stream ) ) ;
3737
3838 using WebpDecoderCore decoder = new ( options ) ;
39- Image < TPixel > image = decoder . Decode < TPixel > ( options . Configuration , stream , cancellationToken ) ;
39+ Image < TPixel > image = decoder . Decode < TPixel > ( options . GeneralOptions . Configuration , stream , cancellationToken ) ;
4040
41- ScaleToTargetSize ( options , image ) ;
41+ ScaleToTargetSize ( options . GeneralOptions , image ) ;
4242
4343 return image ;
4444 }
4545
46+ /// <inheritdoc/>
47+ protected override Image Decode ( WebpDecoderOptions options , Stream stream , CancellationToken cancellationToken )
48+ => this . Decode < Rgba32 > ( options , stream , cancellationToken ) ;
49+
4650 /// <inheritdoc/>
4751 protected override Image Decode ( DecoderOptions options , Stream stream , CancellationToken cancellationToken )
4852 => this . Decode < Rgba32 > ( options , stream , cancellationToken ) ;
53+
54+ /// <inheritdoc/>
55+ protected override WebpDecoderOptions CreateDefaultSpecializedOptions ( DecoderOptions options )
56+ => new ( ) { GeneralOptions = options } ;
4957}
0 commit comments