diff --git a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs index 9413cf467..adbad0d66 100644 --- a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs +++ b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs @@ -17,35 +17,35 @@ namespace SixLabors.ImageSharp.Advanced /// public static partial class ParallelRowIterator { - private readonly struct WrappingRowIntervalInfo + private readonly struct IterationParameters { public readonly int MinY; public readonly int MaxY; public readonly int StepY; - public readonly int MaxX; + public readonly int Width; - public WrappingRowIntervalInfo(int minY, int maxY, int stepY) + public IterationParameters(int minY, int maxY, int stepY) : this(minY, maxY, stepY, 0) { } - public WrappingRowIntervalInfo(int minY, int maxY, int stepY, int maxX) + public IterationParameters(int minY, int maxY, int stepY, int width) { this.MinY = minY; this.MaxY = maxY; this.StepY = stepY; - this.MaxX = maxX; + this.Width = width; } } - private readonly struct WrappingRowIntervalOperation + private readonly struct RowIntervalOperationWrapper where T : struct, IRowIntervalOperation { - private readonly WrappingRowIntervalInfo info; + private readonly IterationParameters info; private readonly T operation; [MethodImpl(InliningOptions.ShortMethod)] - public WrappingRowIntervalOperation(in WrappingRowIntervalInfo info, in T operation) + public RowIntervalOperationWrapper(in IterationParameters info, in T operation) { this.info = info; this.operation = operation; @@ -69,17 +69,17 @@ namespace SixLabors.ImageSharp.Advanced } } - private readonly struct WrappingRowIntervalBufferOperation + private readonly struct RowIntervalOperationWrapper where T : struct, IRowIntervalOperation where TBuffer : unmanaged { - private readonly WrappingRowIntervalInfo info; + private readonly IterationParameters info; private readonly MemoryAllocator allocator; private readonly T operation; [MethodImpl(InliningOptions.ShortMethod)] - public WrappingRowIntervalBufferOperation( - in WrappingRowIntervalInfo info, + public RowIntervalOperationWrapper( + in IterationParameters info, MemoryAllocator allocator, in T operation) { @@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.Advanced int yMax = Math.Min(yMin + this.info.StepY, this.info.MaxY); var rows = new RowInterval(yMin, yMax); - using IMemoryOwner buffer = this.allocator.Allocate(this.info.MaxX); + using IMemoryOwner buffer = this.allocator.Allocate(this.info.Width); Unsafe.AsRef(in this.operation).Invoke(in rows, buffer.Memory.Span); } diff --git a/src/ImageSharp/Advanced/ParallelRowIterator.cs b/src/ImageSharp/Advanced/ParallelRowIterator.cs index b2e7f523f..123784c57 100644 --- a/src/ImageSharp/Advanced/ParallelRowIterator.cs +++ b/src/ImageSharp/Advanced/ParallelRowIterator.cs @@ -65,8 +65,8 @@ namespace SixLabors.ImageSharp.Advanced int verticalStep = DivideCeil(rectangle.Height, numOfSteps); var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps }; - var info = new WrappingRowIntervalInfo(top, bottom, verticalStep); - var wrappingOperation = new WrappingRowIntervalOperation(in info, in operation); + var info = new IterationParameters(top, bottom, verticalStep); + var wrappingOperation = new RowIntervalOperationWrapper(in info, in operation); Parallel.For( 0, @@ -133,8 +133,8 @@ namespace SixLabors.ImageSharp.Advanced int verticalStep = DivideCeil(height, numOfSteps); var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps }; - var info = new WrappingRowIntervalInfo(top, bottom, verticalStep, width); - var wrappingOperation = new WrappingRowIntervalBufferOperation(in info, allocator, in operation); + var info = new IterationParameters(top, bottom, verticalStep, width); + var wrappingOperation = new RowIntervalOperationWrapper(in info, allocator, in operation); Parallel.For( 0,