Browse Source

ResizeTests.LargeImage

af/merge-core
Anton Firszov 7 years ago
parent
commit
eb08150e61
  1. 7
      src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs
  2. 17
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
  3. 2
      tests/Images/External

7
src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs

@ -114,7 +114,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
// Ensure offsets are normalized for cropping and padding. // Ensure offsets are normalized for cropping and padding.
ResizeKernel kernel = this.verticalKernelMap.GetKernel(y - this.targetOrigin.Y); ResizeKernel kernel = this.verticalKernelMap.GetKernel(y - this.targetOrigin.Y);
while (kernel.StartIndex + kernel.Length > this.currentWindow.Max) if (kernel.StartIndex + kernel.Length > this.currentWindow.Max)
{ {
this.Slide(); this.Slide();
} }
@ -145,8 +145,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
private void Slide() private void Slide()
{ {
int minY = this.currentWindow.Min + this.windowBandHeight; int minY = this.currentWindow.Max - this.windowBandHeight;
int maxY = Math.Min(this.currentWindow.Max + this.windowBandHeight, this.sourceRectangle.Height); int maxY = Math.Min(minY + this.workerHeight, this.sourceRectangle.Height);
this.currentWindow = new RowInterval(minY, maxY); this.currentWindow = new RowInterval(minY, maxY);
this.CalculateFirstPassValues(this.currentWindow); this.CalculateFirstPassValues(this.currentWindow);
} }

17
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs

@ -34,12 +34,27 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
public static readonly string[] SmokeTestResamplerNames = public static readonly string[] SmokeTestResamplerNames =
{ {
nameof(KnownResamplers.NearestNeighbor), nameof(KnownResamplers.Bicubic), nameof(KnownResamplers.Box), nameof(KnownResamplers.NearestNeighbor),
nameof(KnownResamplers.Bicubic),
nameof(KnownResamplers.Box),
nameof(KnownResamplers.Lanczos5), nameof(KnownResamplers.Lanczos5),
}; };
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.07F); private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.07F);
[Theory]
[WithTestPatternImages(4000, 4000, PixelTypes.Rgba32)]
public void LargeImage<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (!TestEnvironment.Is64BitProcess)
{
return;
}
provider.RunValidatingProcessorTest(x => x.Resize(300, 300), appendPixelTypeToFileName: false);
}
[Theory] [Theory]
[WithBasicTestPatternImages(15, 12, PixelTypes.Rgba32, 2, 3, 1, 2)] [WithBasicTestPatternImages(15, 12, PixelTypes.Rgba32, 2, 3, 1, 2)]
[WithBasicTestPatternImages(2, 256, PixelTypes.Rgba32, 1, 1, 1, 8)] [WithBasicTestPatternImages(2, 256, PixelTypes.Rgba32, 1, 1, 1, 8)]

2
tests/Images/External

@ -1 +1 @@
Subproject commit 6db7ed95dd8a2de4caa6d885952b6689d026ad27 Subproject commit 8693e2fd4577a9ac1a749da8db564095b5a05389
Loading…
Cancel
Save