diff --git a/src/ImageSharp/Formats/Exr/Compression/Compressors/ZipExrCompressor.cs b/src/ImageSharp/Formats/Exr/Compression/Compressors/ZipExrCompressor.cs index 587ecb7562..dcfbe3ae05 100644 --- a/src/ImageSharp/Formats/Exr/Compression/Compressors/ZipExrCompressor.cs +++ b/src/ImageSharp/Formats/Exr/Compression/Compressors/ZipExrCompressor.cs @@ -11,7 +11,7 @@ internal class ZipExrCompressor : ExrBaseCompressor { private readonly DeflateCompressionLevel compressionLevel; - private readonly MemoryStream memoryStream = new(); + private readonly MemoryStream memoryStream; private readonly System.Buffers.IMemoryOwner buffer; @@ -20,6 +20,7 @@ internal class ZipExrCompressor : ExrBaseCompressor { this.compressionLevel = compressionLevel; this.buffer = allocator.Allocate((int)bytesPerBlock); + this.memoryStream = new(); } /// diff --git a/src/ImageSharp/Formats/Exr/ExrDecoderCore.cs b/src/ImageSharp/Formats/Exr/ExrDecoderCore.cs index f8eb17f4e8..6773f3b631 100644 --- a/src/ImageSharp/Formats/Exr/ExrDecoderCore.cs +++ b/src/ImageSharp/Formats/Exr/ExrDecoderCore.cs @@ -53,7 +53,7 @@ internal sealed class ExrDecoderCore : ImageDecoderCore : base(options.GeneralOptions) { this.configuration = options.GeneralOptions.Configuration; - this.memoryAllocator = this.configuration.MemoryAllocator; + this.memoryAllocator = this.configuration.MemoryAllocator; } /// diff --git a/tests/ImageSharp.Tests/Formats/Exr/ExrEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Exr/ExrEncoderTests.cs index b16c925f8a..6aa3ebc70b 100644 --- a/tests/ImageSharp.Tests/Formats/Exr/ExrEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Exr/ExrEncoderTests.cs @@ -19,17 +19,17 @@ public class ExrEncoderTests [Theory] [WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)] public void ExrEncoder_WithNoCompression_Works(TestImageProvider provider) - where TPixel : unmanaged, IPixel => TestExrEncoderCore(provider, "NoCompression", compression: ExrCompression.None, imageDecoder: ExrDecoder.Instance); + where TPixel : unmanaged, IPixel => TestExrEncoderCore(provider, "NoCompression", compression: ExrCompression.None); [Theory] [WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)] public void ExrEncoder_WithZipCompression_Works(TestImageProvider provider) - where TPixel : unmanaged, IPixel => TestExrEncoderCore(provider, "ZipCompression", compression: ExrCompression.Zip, imageDecoder: ExrDecoder.Instance); + where TPixel : unmanaged, IPixel => TestExrEncoderCore(provider, "ZipCompression", compression: ExrCompression.Zip); [Theory] [WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)] public void ExrEncoder_WithZipsCompression_Works(TestImageProvider provider) - where TPixel : unmanaged, IPixel => TestExrEncoderCore(provider, "ZipsCompression", compression: ExrCompression.Zips, imageDecoder: ExrDecoder.Instance); + where TPixel : unmanaged, IPixel => TestExrEncoderCore(provider, "ZipsCompression", compression: ExrCompression.Zips); protected static void TestExrEncoderCore( TestImageProvider provider,