From a7a2b0b5199b11ba03d739751a74844ebd42cec6 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 26 Feb 2018 19:25:07 +0100 Subject: [PATCH] adding a few TODO notes --- src/ImageSharp/Processing/Processors/CloningImageProcessor.cs | 3 +++ .../Processing/Processors/Transforms/ResizeProcessor.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs b/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs index 4672b2ad45..7257bd6643 100644 --- a/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs +++ b/src/ImageSharp/Processing/Processors/CloningImageProcessor.cs @@ -96,6 +96,7 @@ namespace SixLabors.ImageSharp.Processing /// /// This method is called before the process is applied to prepare the processor. + /// TODO: We should probably name this 'BeforeFrameApply' /// /// The source image. Cannot be null. /// The cloned/destination image. Cannot be null. @@ -108,6 +109,7 @@ namespace SixLabors.ImageSharp.Processing /// /// Applies the process to the specified portion of the specified at the specified location /// and with the specified size. + /// TODO: We should probably name this 'ApplyToFrame' /// /// The source image. Cannot be null. /// The cloned/destination image. Cannot be null. @@ -117,6 +119,7 @@ namespace SixLabors.ImageSharp.Processing /// /// This method is called after the process is applied to prepare the processor. + /// TODO: We should probably name this 'AfterFrameApply' /// /// The source image. Cannot be null. /// The cloned/destination image. Cannot be null. diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs index bccf665a48..8638990913 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs @@ -223,6 +223,7 @@ namespace SixLabors.ImageSharp.Processing.Processors { if (!(this.Sampler is NearestNeighborResampler)) { + // TODO: Optimization opportunity: if we could assume that all frames are of the same size, we can move this into 'BeforeImageApply()` this.horizontalWeights = this.PrecomputeWeights( this.ResizeRectangle.Width, sourceRectangle.Width); @@ -367,6 +368,8 @@ namespace SixLabors.ImageSharp.Processing.Processors protected override void AfterApply(ImageFrame source, ImageFrame destination, Rectangle sourceRectangle, Configuration configuration) { base.AfterApply(source, destination, sourceRectangle, configuration); + + // TODO: An exception in the processing chain can leave these buffers undisposed. We should consider making image processors IDisposable! this.horizontalWeights?.Dispose(); this.horizontalWeights = null; this.verticalWeights?.Dispose();