diff --git a/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs b/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs
index 95ead2bf0..fcb7d0d5c 100644
--- a/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs
+++ b/src/ImageProcessorCore/Samplers/Processors/ResizeProcessor.cs
@@ -13,11 +13,6 @@ namespace ImageProcessorCore.Processors
///
public class ResizeProcessor : ImageSampler
{
- ///
- /// The image used for storing the first pass pixels.
- ///
- private Image firstPass;
-
///
/// Initializes a new instance of the class.
///
@@ -54,8 +49,6 @@ namespace ImageProcessorCore.Processors
this.HorizontalWeights = this.PrecomputeWeights(targetRectangle.Width, sourceRectangle.Width);
this.VerticalWeights = this.PrecomputeWeights(targetRectangle.Height, sourceRectangle.Height);
}
-
- this.firstPass = new Image(target.Width, source.Height);
}
///
@@ -121,8 +114,9 @@ namespace ImageProcessorCore.Processors
// A 2-pass 1D algorithm appears to be faster than splitting a 1-pass 2D algorithm
// First process the columns. Since we are not using multiple threads startY and endY
// are the upper and lower bounds of the source rectangle.
+ Image firstPass = new Image(target.Width, source.Height);
using (PixelAccessor sourcePixels = source.Lock())
- using (PixelAccessor firstPassPixels = this.firstPass.Lock())
+ using (PixelAccessor firstPassPixels = firstPass.Lock())
using (PixelAccessor targetPixels = target.Lock())
{
Parallel.For(
diff --git a/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs b/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs
index 479392cc8..bee3fe3cb 100644
--- a/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs
+++ b/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs
@@ -12,9 +12,9 @@
[Benchmark(Baseline = true, Description = "System.Drawing Resize")]
public Size ResizeSystemDrawing()
{
- using (Bitmap source = new Bitmap(400, 400))
+ using (Bitmap source = new Bitmap(2000, 2000))
{
- using (Bitmap destination = new Bitmap(100, 100))
+ using (Bitmap destination = new Bitmap(400, 400))
{
using (Graphics graphics = Graphics.FromImage(destination))
{
@@ -32,8 +32,8 @@
[Benchmark(Description = "ImageProcessorCore Resize")]
public CoreSize ResizeCore()
{
- CoreImage image = new CoreImage(400, 400);
- image.Resize(100, 100);
+ CoreImage image = new CoreImage(2000, 2000);
+ image.Resize(400, 400);
return new CoreSize(image.Width, image.Height);
}
}