Skip to content

Commit b545ea0

Browse files
committed
Rename APIs
1 parent 3da200d commit b545ea0

11 files changed

+12
-75
lines changed

src/ImageSharp/Advanced/ParallelRowIterator.cs

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static void IterateRows<T>(
8888
/// <param name="configuration">The <see cref="Configuration"/> to get the parallel settings from.</param>
8989
/// <param name="body">The method body defining the iteration logic on a single <see cref="RowInterval"/>.</param>
9090
public static void IterateRows<T, TBuffer>(Rectangle rectangle, Configuration configuration, in T body)
91-
where T : struct, IRowIntervalAction<TBuffer>
91+
where T : struct, IRowAction<TBuffer>
9292
where TBuffer : unmanaged
9393
{
9494
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
@@ -100,69 +100,6 @@ public static void IterateRows<T, TBuffer>(Rectangle rectangle, Configuration co
100100
/// instantiating a temporary buffer for each <paramref name="body"/> invocation.
101101
/// </summary>
102102
internal static void IterateRows<T, TBuffer>(
103-
Rectangle rectangle,
104-
in ParallelExecutionSettings parallelSettings,
105-
in T body)
106-
where T : struct, IRowIntervalAction<TBuffer>
107-
where TBuffer : unmanaged
108-
{
109-
ValidateRectangle(rectangle);
110-
111-
int top = rectangle.Top;
112-
int bottom = rectangle.Bottom;
113-
int width = rectangle.Width;
114-
int height = rectangle.Height;
115-
116-
int maxSteps = DivideCeil(width * height, parallelSettings.MinimumPixelsProcessedPerTask);
117-
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps);
118-
MemoryAllocator allocator = parallelSettings.MemoryAllocator;
119-
120-
// Avoid TPL overhead in this trivial case:
121-
if (numOfSteps == 1)
122-
{
123-
var rows = new RowInterval(top, bottom);
124-
using (IMemoryOwner<TBuffer> buffer = allocator.Allocate<TBuffer>(width))
125-
{
126-
Unsafe.AsRef(body).Invoke(rows, buffer.Memory);
127-
}
128-
129-
return;
130-
}
131-
132-
int verticalStep = DivideCeil(height, numOfSteps);
133-
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps };
134-
var rowInfo = new WrappingRowIntervalInfo(top, bottom, verticalStep, width);
135-
var rowAction = new WrappingRowIntervalBufferAction<T, TBuffer>(in rowInfo, allocator, in body);
136-
137-
Parallel.For(
138-
0,
139-
numOfSteps,
140-
parallelOptions,
141-
rowAction.Invoke);
142-
}
143-
144-
/// <summary>
145-
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s
146-
/// instantiating a temporary buffer for each <paramref name="body"/> invocation.
147-
/// </summary>
148-
/// <typeparam name="T">The type of row action to perform.</typeparam>
149-
/// <typeparam name="TBuffer">The type of buffer elements.</typeparam>
150-
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
151-
/// <param name="configuration">The <see cref="Configuration"/> to get the parallel settings from.</param>
152-
/// <param name="body">The method body defining the iteration logic on a single <see cref="RowInterval"/>.</param>
153-
public static void IterateRows2<T, TBuffer>(Rectangle rectangle, Configuration configuration, in T body)
154-
where T : struct, IRowAction<TBuffer>
155-
where TBuffer : unmanaged
156-
{
157-
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
158-
IterateRows2<T, TBuffer>(rectangle, in parallelSettings, in body);
159-
}
160-
161-
/// <summary>
162-
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s
163-
/// instantiating a temporary buffer for each <paramref name="body"/> invocation.
164-
/// </summary>
165-
internal static void IterateRows2<T, TBuffer>(
166103
Rectangle rectangle,
167104
in ParallelExecutionSettings parallelSettings,
168105
in T body)

src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private void NormalizeKernels()
268268
protected override void OnFrameApply(ImageFrame<TPixel> source)
269269
{
270270
// Preliminary gamma highlight pass
271-
ParallelRowIterator.IterateRows2<ApplyGammaExposureRowAction, Vector4>(
271+
ParallelRowIterator.IterateRows<ApplyGammaExposureRowAction, Vector4>(
272272
this.SourceRectangle,
273273
this.Configuration,
274274
new ApplyGammaExposureRowAction(this.SourceRectangle, source.PixelBuffer, this.Configuration, this.gamma));

src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
6666

6767
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
6868

69-
ParallelRowIterator.IterateRows2<RowAction, Vector4>(
69+
ParallelRowIterator.IterateRows<RowAction, Vector4>(
7070
interest,
7171
this.Configuration,
7272
new RowAction(interest, targetPixels, source.PixelBuffer, this.KernelY, this.KernelX, this.Configuration, this.PreserveAlpha));

src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
6464
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
6565

6666
// Horizontal convolution
67-
ParallelRowIterator.IterateRows2<RowAction, Vector4>(
67+
ParallelRowIterator.IterateRows<RowAction, Vector4>(
6868
interest,
6969
this.Configuration,
7070
new RowAction(interest, firstPassPixels, source.PixelBuffer, this.KernelX, this.Configuration, this.PreserveAlpha));
7171

7272
// Vertical convolution
73-
ParallelRowIterator.IterateRows2<RowAction, Vector4>(
73+
ParallelRowIterator.IterateRows<RowAction, Vector4>(
7474
interest,
7575
this.Configuration,
7676
new RowAction(interest, source.PixelBuffer, firstPassPixels, this.KernelY, this.Configuration, this.PreserveAlpha));

src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
5757

5858
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
5959

60-
ParallelRowIterator.IterateRows2<RowAction, Vector4>(
60+
ParallelRowIterator.IterateRows<RowAction, Vector4>(
6161
interest,
6262
this.Configuration,
6363
new RowAction(interest, targetPixels, source.PixelBuffer, this.KernelXY, this.Configuration, this.PreserveAlpha));

src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
5050
{
5151
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
5252

53-
ParallelRowIterator.IterateRows2<RowAction, Vector4>(
53+
ParallelRowIterator.IterateRows<RowAction, Vector4>(
5454
interest,
5555
this.Configuration,
5656
new RowAction(interest.X, source, this.Configuration, this.modifiers, this.rowDelegate));

src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
3636
{
3737
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
3838

39-
ParallelRowIterator.IterateRows2<RowAction, Vector4>(
39+
ParallelRowIterator.IterateRows<RowAction, Vector4>(
4040
interest,
4141
this.Configuration,
4242
new RowAction(interest.X, source, this.definition.Matrix, this.Configuration));

src/ImageSharp/Processing/Processors/Overlays/GlowProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
5555
using IMemoryOwner<TPixel> rowColors = allocator.Allocate<TPixel>(interest.Width);
5656
rowColors.GetSpan().Fill(glowColor);
5757

58-
ParallelRowIterator.IterateRows2<RowAction, float>(
58+
ParallelRowIterator.IterateRows<RowAction, float>(
5959
interest,
6060
configuration,
6161
new RowAction(configuration, interest, rowColors, this.blender, center, maxDistance, blendPercent, source));

src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
6363
using IMemoryOwner<TPixel> rowColors = allocator.Allocate<TPixel>(interest.Width);
6464
rowColors.GetSpan().Fill(vignetteColor);
6565

66-
ParallelRowIterator.IterateRows2<RowAction, float>(
66+
ParallelRowIterator.IterateRows<RowAction, float>(
6767
interest,
6868
configuration,
6969
new RowAction(configuration, interest, rowColors, this.blender, center, maxDistance, blendPercent, source));

src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, ImageFrame<TPixe
6767

6868
using var kernelMap = new TransformKernelMap(configuration, source.Size(), destination.Size(), this.resampler);
6969

70-
ParallelRowIterator.IterateRows2<RowAction, Vector4>(
70+
ParallelRowIterator.IterateRows<RowAction, Vector4>(
7171
targetBounds,
7272
configuration,
7373
new RowAction(configuration, kernelMap, ref matrix, width, source, destination));

0 commit comments

Comments
 (0)