diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs index 4e3a08c393..93aeb75f48 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs @@ -88,7 +88,8 @@ public ResizeWorker( this.transposedFirstPassBuffer = configuration.MemoryAllocator.Allocate2D( this.workerHeight, destWidth, - AllocationOptions.Clean); + preferContiguosImageBuffers: true, + options: AllocationOptions.Clean); this.tempRowBuffer = configuration.MemoryAllocator.Allocate(this.sourceRectangle.Width); this.tempColumnBuffer = configuration.MemoryAllocator.Allocate(destWidth); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index 022bb224c4..6e275b824e 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -669,5 +669,17 @@ public void Issue1342(int width, int height) Assert.Equal(height, image.Height); } } + + [Theory] + [WithBasicTestPatternImages(20, 20, PixelTypes.Rgba32)] + public void Issue1625_LimitedAllocator(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + provider.LimitAllocatorBufferCapacity().InBytes(1000); + provider.RunValidatingProcessorTest( + x => x.Resize(30, 30), + appendPixelTypeToFileName: false, + appendSourceFileOrDescription: false); + } } } diff --git a/tests/Images/External/ReferenceOutput/ResizeTests/Issue1625_LimitedAllocator.png b/tests/Images/External/ReferenceOutput/ResizeTests/Issue1625_LimitedAllocator.png new file mode 100644 index 0000000000..01e9cf38f3 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/ResizeTests/Issue1625_LimitedAllocator.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bedaced9c302ff735319f189d867b6a722ed4eade63152b67cf07881f8b3964d +size 289