diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj index be0e9032b..0d803475a 100644 --- a/src/ImageSharp/ImageSharp.csproj +++ b/src/ImageSharp/ImageSharp.csproj @@ -10,7 +10,8 @@ $(packageversion) 0.0.1 - netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.3;net472 + + netcoreapp3.1 true true diff --git a/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs b/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs index d40d6ec4c..f9a562b9d 100644 --- a/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs +++ b/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs @@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.Tests.Advanced public void OwnedMemory_PixelDataIsCorrect(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(200); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(200); using Image image = provider.GetImage(); @@ -106,7 +106,7 @@ namespace SixLabors.ImageSharp.Tests.Advanced public void GetPixelRowMemory_PixelDataIsCorrect(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(200); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(200); using Image image = provider.GetImage(); @@ -147,7 +147,7 @@ namespace SixLabors.ImageSharp.Tests.Advanced public void GetPixelRowSpan_ShouldReferenceSpanOfMemory(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(200); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(200); using Image image = provider.GetImage(); diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs index 264516063..4705fa3f2 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp if (!string.IsNullOrEmpty(nonContiguousBuffersStr)) { - provider.LimitAllocatorBufferCapacity().InPixels(100); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100); } using Image image = provider.GetImage(BmpDecoder); @@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp public void BmpDecoder_DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatException(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(10); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(10); ImageFormatException ex = Assert.Throws(() => provider.GetImage(BmpDecoder)); Assert.IsType(ex.InnerException); } @@ -261,7 +261,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp { if (enforceDiscontiguousBuffers) { - provider.LimitAllocatorBufferCapacity().InBytes(400); + provider.LimitAllocatorBufferCapacity().InBytesSqrt(400); } using (Image image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.FirstColorOfPalette })) @@ -283,7 +283,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp { if (enforceNonContiguous) { - provider.LimitAllocatorBufferCapacity().InBytes(400); + provider.LimitAllocatorBufferCapacity().InBytesSqrt(400); } using (Image image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.Black })) diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs index 7f9736530..4fd1d6490 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs @@ -246,7 +246,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp public void Encode_WorksWithDiscontiguousBuffers(TestImageProvider provider, BmpBitsPerPixel bitsPerPixel) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InBytes(100); + provider.LimitAllocatorBufferCapacity().InBytesSqrt(100); TestBmpEncoderCore(provider, bitsPerPixel); } diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs index 2b25f8e87..45c768892 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs @@ -175,7 +175,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif public void GifDecoder_DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatException(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(10); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(10); ImageFormatException ex = Assert.Throws(() => provider.GetImage(GifDecoder)); Assert.IsType(ex.InnerException); } @@ -190,7 +190,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif { TestImageProvider provider = BasicSerializer.Deserialize>(providerDump); - provider.LimitAllocatorBufferCapacity().InPixels(100); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100); using Image image = provider.GetImage(GifDecoder); image.DebugSave(provider); diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs index 4c710cdb2..1fc99922d 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs @@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif { if (limitAllocationBuffer) { - provider.LimitAllocatorBufferCapacity().InPixels(100); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100); } using (Image image = provider.GetImage()) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs index 44408841c..5428039c4 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs @@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg { [Theory] [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Rgba32, false)] - // [WithFile(TestImages.Jpeg.Baseline.Calliphora, PixelTypes.Rgba32, true)] + [WithFile(TestImages.Jpeg.Baseline.Calliphora, PixelTypes.Rgba32, true)] public void DecodeBaselineJpeg(TestImageProvider provider, bool enforceDiscontiguousBuffers) where TPixel : struct, IPixel { @@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg if (!string.IsNullOrEmpty(nonContiguousBuffersStr)) { - provider.LimitAllocatorBufferCapacity().InBytes(200); + provider.LimitAllocatorBufferCapacity().InBytesSqrt(200); } using Image image = provider.GetImage(JpegDecoder); @@ -40,11 +40,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg } string providerDump = BasicSerializer.Serialize(provider); - RemoteExecutor.Invoke( - RunTest, - providerDump, - enforceDiscontiguousBuffers ? "Disco" : string.Empty) - .Dispose(); + RunTest(providerDump, enforceDiscontiguousBuffers ? "Disco" : string.Empty); + + // RemoteExecutor.Invoke( + // RunTest, + // providerDump, + // enforceDiscontiguousBuffers ? "Disco" : string.Empty) + // .Dispose(); } [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs index 5d94ed985..c0169992d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs @@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg if (!string.IsNullOrEmpty(nonContiguousBuffersStr)) { - provider.LimitAllocatorBufferCapacity().InBytes(200); + provider.LimitAllocatorBufferCapacity().InBytesSqrt(200); } using Image image = provider.GetImage(JpegDecoder); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 97dd4f001..32060df9a 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -111,7 +111,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg public void DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatException(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InBytes(10); + provider.LimitAllocatorBufferCapacity().InBytesSqrt(10); ImageFormatException ex = Assert.Throws(() => provider.GetImage(JpegDecoder)); this.Output.WriteLine(ex.Message); Assert.IsType(ex.InnerException); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs index 56dd37874..b62a555b8 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs @@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg ? ImageComparer.TolerantPercentage(0.1f) : ImageComparer.TolerantPercentage(5f); - provider.LimitAllocatorBufferCapacity().InBytes(200); + provider.LimitAllocatorBufferCapacity().InBytesSqrt(200); TestJpegEncoderCore(provider, subsample, 100, comparer); } diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs index 14b29d194..bf767e811 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs @@ -249,7 +249,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png public void PngDecoder_DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatException(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(10); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(10); ImageFormatException ex = Assert.Throws(() => provider.GetImage(PngDecoder)); Assert.IsType(ex.InnerException); } @@ -264,7 +264,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png { TestImageProvider provider = BasicSerializer.Deserialize>(providerDump); - provider.LimitAllocatorBufferCapacity().InPixels(100); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100); using Image image = provider.GetImage(PngDecoder); image.DebugSave(provider, testOutputDetails: nonContiguousBuffersStr); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index a26bb7353..20a2d0233 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -410,7 +410,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png public void Encode_WorksWithDiscontiguousBuffers(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(200); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(200); foreach (PngInterlaceMode interlaceMode in InterlaceMode) { TestPngEncoderCore( diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs index a83ff5d63..985ccb596 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs @@ -205,7 +205,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga public void TgaDecoder_DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatException(TestImageProvider provider) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(10); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(10); ImageFormatException ex = Assert.Throws(() => provider.GetImage(TgaDecoder)); Assert.IsType(ex.InnerException); } @@ -220,7 +220,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga { TestImageProvider provider = BasicSerializer.Deserialize>(providerDump); - provider.LimitAllocatorBufferCapacity().InPixels(100); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100); using Image image = provider.GetImage(TgaDecoder); image.DebugSave(provider, testOutputDetails: nonContiguousBuffersStr); diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaEncoderTests.cs index 2bb49a93e..339945f8b 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaEncoderTests.cs @@ -128,7 +128,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga public void Encode_WorksWithDiscontiguousBuffers(TestImageProvider provider, TgaBitsPerPixel bitsPerPixel) where TPixel : struct, IPixel { - provider.LimitAllocatorBufferCapacity().InPixels(100); + provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100); TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.RunLength); } diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj index 34cdca49a..fdefa38e7 100644 --- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj +++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj @@ -2,7 +2,8 @@ - netcoreapp3.1;netcoreapp2.1;net472 + + netcoreapp3.1 True True SixLabors.ImageSharp.Tests diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs index cea057330..d0836e19f 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs @@ -763,19 +763,19 @@ namespace SixLabors.ImageSharp.Tests } /// - /// Set the maximum buffer capacity to (areaDimensionBytes x areaDimensionBytes) bytes. + /// Set the maximum buffer capacity to bytesSqrt^2 bytes. /// - public void InBytes(int areaDimensionBytes) + public void InBytesSqrt(int bytesSqrt) { - this.allocator.BufferCapacityInBytes = areaDimensionBytes * areaDimensionBytes; + this.allocator.BufferCapacityInBytes = bytesSqrt * bytesSqrt; } /// - /// Set the maximum buffer capacity to (areaDimensionPixels x areaDimensionPixels x size of the pixel) bytes. + /// Set the maximum buffer capacity to pixelsSqrt^2 x sizeof(TPixel) bytes. /// - public void InPixels(int areaDimensionPixels) + public void InPixelsSqrt(int pixelsSqrt) { - this.allocator.BufferCapacityInBytes = areaDimensionPixels * areaDimensionPixels * this.pixelSizeInBytes; + this.allocator.BufferCapacityInBytes = pixelsSqrt * pixelsSqrt * this.pixelSizeInBytes; } } }