From c84cb48ba53e635043216aeec085435a0248d533 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 23 Sep 2018 02:01:24 +0200 Subject: [PATCH] cleanup & docs --- .../ParallelUtils/ParallelExecutionSettings.cs | 13 +++++++++++++ .../Common/ParallelUtils/ParallelHelper.cs | 10 ++++------ src/ImageSharp/Memory/RowInterval.cs | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/ImageSharp/Common/ParallelUtils/ParallelExecutionSettings.cs b/src/ImageSharp/Common/ParallelUtils/ParallelExecutionSettings.cs index 9b2ae89d0a..dc24383146 100644 --- a/src/ImageSharp/Common/ParallelUtils/ParallelExecutionSettings.cs +++ b/src/ImageSharp/Common/ParallelUtils/ParallelExecutionSettings.cs @@ -17,6 +17,9 @@ namespace SixLabors.ImageSharp.ParallelUtils /// public const int DefaultMinimumPixelsProcessedPerTask = 4096; + /// + /// Initializes a new instance of the struct. + /// public ParallelExecutionSettings( int maxDegreeOfParallelism, int minimumPixelsProcessedPerTask, @@ -27,11 +30,17 @@ namespace SixLabors.ImageSharp.ParallelUtils this.MemoryAllocator = memoryAllocator; } + /// + /// Initializes a new instance of the struct. + /// public ParallelExecutionSettings(int maxDegreeOfParallelism, MemoryAllocator memoryAllocator) : this(maxDegreeOfParallelism, DefaultMinimumPixelsProcessedPerTask, memoryAllocator) { } + /// + /// Gets the MemoryAllocator + /// public MemoryAllocator MemoryAllocator { get; } /// @@ -46,6 +55,10 @@ namespace SixLabors.ImageSharp.ParallelUtils /// public int MinimumPixelsProcessedPerTask { get; } + /// + /// Creates a new instance of + /// having multiplied by + /// public ParallelExecutionSettings MultiplyMinimumPixelsPerTask(int multiplier) { return new ParallelExecutionSettings( diff --git a/src/ImageSharp/Common/ParallelUtils/ParallelHelper.cs b/src/ImageSharp/Common/ParallelUtils/ParallelHelper.cs index 3009e99fc4..1f999cfd2b 100644 --- a/src/ImageSharp/Common/ParallelUtils/ParallelHelper.cs +++ b/src/ImageSharp/Common/ParallelUtils/ParallelHelper.cs @@ -127,6 +127,10 @@ namespace SixLabors.ImageSharp.ParallelUtils }); } + /// + /// Iterate through the rows of a rectangle in optimized batches defined by -s + /// instantiating a temporary buffer for each invocation. + /// public static void IterateRowsWithTempBuffer( Rectangle rectangle, Configuration configuration, @@ -143,11 +147,5 @@ namespace SixLabors.ImageSharp.ParallelUtils int result = dividend / divisor; return dividend % divisor == 0 ? result : result + 1; } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int DivideRound(int dividend, int divisor) - { - return (dividend + (divisor / 2)) / divisor; - } } } \ No newline at end of file diff --git a/src/ImageSharp/Memory/RowInterval.cs b/src/ImageSharp/Memory/RowInterval.cs index 273a6aa346..0750e0368c 100644 --- a/src/ImageSharp/Memory/RowInterval.cs +++ b/src/ImageSharp/Memory/RowInterval.cs @@ -10,6 +10,9 @@ namespace SixLabors.ImageSharp.Memory /// internal readonly struct RowInterval { + /// + /// Initializes a new instance of the struct. + /// public RowInterval(int min, int max) { DebugGuard.MustBeLessThan(min, max, nameof(min));