From 0fe18b7bb6797c735c5aa73635bd0de74e57884a Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 7 Jul 2016 13:31:56 +1000 Subject: [PATCH 1/2] Add warning [skip ci] Former-commit-id: eb0108db0effecd5252e770d690ce5b6b0e65e69 Former-commit-id: a80e08dbba6f556cc24ec5141541e187a71dda7d Former-commit-id: 5ba5ae9d5a75165dd7ac4f5da27269ba98363970 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index af25681e9..85edc9956 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ -**ImageProcessorCore** is a new cross-platform 2D graphics API designed to allow the processing of images without the use of `System.Drawing`. It's still in early stages but progress has been pretty quick. +**ImageProcessorCore** is a new cross-platform 2D graphics API designed to allow the processing of images without the use of `System.Drawing`. It's still in early stages (alpha) but progress has been pretty quick. + +**Please do not use on production environments until the library reaches release candidate status.** [![Build status](https://ci.appveyor.com/api/projects/status/8ypr7527dnao04yr/branch/Core?svg=true)](https://ci.appveyor.com/project/JamesSouth/imageprocessor/branch/Core) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/JimBobSquarePants/ImageProcessor?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From 96370a7901db609d31fe784e557a5a75c0541d46 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 8 Jul 2016 16:32:10 +1000 Subject: [PATCH 2/2] No need to store the firstpass image as a variable. Former-commit-id: a1f0b1c9a76b4bf24a704cfd95a922b11ded8189 Former-commit-id: df58b4f394a68e48fd3755ce250ec4ec062cc62f Former-commit-id: 9234222f848afbdf9461e16ea76974fe56da37a6 --- .../Samplers/Processors/ResizeProcessor.cs | 10 ++-------- tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs | 8 ++++---- 2 files changed, 6 insertions(+), 12 deletions(-) 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); } }