diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResizeKernel.cs b/src/ImageSharp/Processing/Processors/Transforms/ResizeKernel.cs index ce2e3c92c..cc3c20453 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResizeKernel.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResizeKernel.cs @@ -27,11 +27,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms /// public int Length; - /// - /// The index in the destination buffer - /// - private readonly int flatStartIndex; - /// /// The buffer containing the weights values. /// @@ -47,9 +42,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms [MethodImpl(InliningOptions.ShortMethod)] internal ResizeKernel(int index, int left, Buffer2D buffer, int length) { - this.flatStartIndex = index * buffer.Width; + int flatStartIndex = index * buffer.Width; this.Left = left; - this.buffer = buffer.MemorySource.Memory; + this.buffer = buffer.MemorySource.Memory.Slice(flatStartIndex, length); this.Length = length; } @@ -61,7 +56,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms public ref float GetStartReference() { Span span = this.buffer.Span; - return ref span[this.flatStartIndex]; + return ref span[0]; } /// @@ -69,7 +64,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms /// /// The [MethodImpl(InliningOptions.ShortMethod)] - public Span GetSpan() => this.buffer.Span.Slice(this.flatStartIndex, this.Length); + public Span GetSpan() => this.buffer.Span; /// /// Computes the sum of vectors in 'rowSpan' weighted by weight values, pointed by this instance.