@@ -44,7 +44,6 @@ public static void IterateRows<T>(
4444 where T : struct , IRowOperation
4545 {
4646 ValidateRectangle ( rectangle ) ;
47- ValidateSettings ( parallelSettings ) ;
4847
4948 int top = rectangle . Top ;
5049 int bottom = rectangle . Bottom ;
@@ -109,7 +108,6 @@ public static void IterateRows<T, TBuffer>(
109108 where TBuffer : unmanaged
110109 {
111110 ValidateRectangle ( rectangle ) ;
112- ValidateSettings ( parallelSettings ) ;
113111
114112 int top = rectangle . Top ;
115113 int bottom = rectangle . Bottom ;
@@ -174,7 +172,6 @@ public static void IterateRowIntervals<T>(
174172 where T : struct , IRowIntervalOperation
175173 {
176174 ValidateRectangle ( rectangle ) ;
177- ValidateSettings ( parallelSettings ) ;
178175
179176 int top = rectangle . Top ;
180177 int bottom = rectangle . Bottom ;
@@ -236,7 +233,6 @@ public static void IterateRowIntervals<T, TBuffer>(
236233 where TBuffer : unmanaged
237234 {
238235 ValidateRectangle ( rectangle ) ;
239- ValidateSettings ( parallelSettings ) ;
240236
241237 int top = rectangle . Top ;
242238 int bottom = rectangle . Bottom ;
@@ -315,35 +311,4 @@ private static void ValidateRectangle(Rectangle rectangle)
315311 0 ,
316312 $ "{ nameof ( rectangle ) } .{ nameof ( rectangle . Height ) } ") ;
317313 }
318-
319- /// <summary>
320- /// Validates the supplied <see cref="ParallelExecutionSettings"/>.
321- /// </summary>
322- /// <param name="parallelSettings">The execution settings.</param>
323- /// <exception cref="ArgumentOutOfRangeException">
324- /// Thrown when <see cref="ParallelExecutionSettings.MaxDegreeOfParallelism"/> or
325- /// <see cref="ParallelExecutionSettings.MinimumPixelsProcessedPerTask"/> is invalid.
326- /// </exception>
327- /// <exception cref="ArgumentNullException">
328- /// Thrown when <see cref="ParallelExecutionSettings.MemoryAllocator"/> is null.
329- /// This also guards the public <see cref="ParallelExecutionSettings"/> default value, which bypasses constructor validation.
330- /// </exception>
331- private static void ValidateSettings ( in ParallelExecutionSettings parallelSettings )
332- {
333- // ParallelExecutionSettings is a public struct, so callers can pass default and bypass constructor validation.
334- if ( parallelSettings . MaxDegreeOfParallelism is 0 or < - 1 )
335- {
336- throw new ArgumentOutOfRangeException (
337- $ "{ nameof ( parallelSettings ) } .{ nameof ( ParallelExecutionSettings . MaxDegreeOfParallelism ) } ") ;
338- }
339-
340- Guard . MustBeGreaterThan (
341- parallelSettings . MinimumPixelsProcessedPerTask ,
342- 0 ,
343- $ "{ nameof ( parallelSettings ) } .{ nameof ( ParallelExecutionSettings . MinimumPixelsProcessedPerTask ) } ") ;
344-
345- Guard . NotNull (
346- parallelSettings . MemoryAllocator ,
347- $ "{ nameof ( parallelSettings ) } .{ nameof ( ParallelExecutionSettings . MemoryAllocator ) } ") ;
348- }
349314}
0 commit comments