|
|
|
@ -50,7 +50,7 @@ public static partial class ParallelRowIterator |
|
|
|
int width = rectangle.Width; |
|
|
|
int height = rectangle.Height; |
|
|
|
|
|
|
|
int maxSteps = DivideCeil(width * height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int maxSteps = DivideCeil(width * (long)height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|
|
|
|
|
|
|
// Avoid TPL overhead in this trivial case:
|
|
|
|
@ -115,7 +115,7 @@ public static partial class ParallelRowIterator |
|
|
|
int width = rectangle.Width; |
|
|
|
int height = rectangle.Height; |
|
|
|
|
|
|
|
int maxSteps = DivideCeil(width * height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int maxSteps = DivideCeil(width * (long)height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|
|
|
MemoryAllocator allocator = parallelSettings.MemoryAllocator; |
|
|
|
int bufferLength = Unsafe.AsRef(operation).GetRequiredBufferLength(rectangle); |
|
|
|
@ -180,7 +180,7 @@ public static partial class ParallelRowIterator |
|
|
|
int width = rectangle.Width; |
|
|
|
int height = rectangle.Height; |
|
|
|
|
|
|
|
int maxSteps = DivideCeil(width * height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int maxSteps = DivideCeil(width * (long)height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|
|
|
|
|
|
|
// Avoid TPL overhead in this trivial case:
|
|
|
|
@ -242,7 +242,7 @@ public static partial class ParallelRowIterator |
|
|
|
int width = rectangle.Width; |
|
|
|
int height = rectangle.Height; |
|
|
|
|
|
|
|
int maxSteps = DivideCeil(width * height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int maxSteps = DivideCeil(width * (long)height, parallelSettings.MinimumPixelsProcessedPerTask); |
|
|
|
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|
|
|
MemoryAllocator allocator = parallelSettings.MemoryAllocator; |
|
|
|
int bufferLength = Unsafe.AsRef(operation).GetRequiredBufferLength(rectangle); |
|
|
|
@ -270,7 +270,7 @@ public static partial class ParallelRowIterator |
|
|
|
} |
|
|
|
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
private static int DivideCeil(int dividend, int divisor) => 1 + ((dividend - 1) / divisor); |
|
|
|
private static int DivideCeil(long dividend, int divisor) => (int)Math.Min(1 + ((dividend - 1) / divisor), int.MaxValue); |
|
|
|
|
|
|
|
private static void ValidateRectangle(Rectangle rectangle) |
|
|
|
{ |
|
|
|
|