Skip to content

Commit f1a0cdb

Browse files
Merge -> Concat
1 parent 8e80543 commit f1a0cdb

File tree

4 files changed

+14
-21
lines changed

4 files changed

+14
-21
lines changed

src/ImageSharp.Drawing/CubicBezierLineSegment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public CubicBezierLineSegment(PointF[] points)
4646
/// <param name="end">The end.</param>
4747
/// <param name="additionalPoints">The additional points.</param>
4848
public CubicBezierLineSegment(PointF start, PointF controlPoint1, PointF controlPoint2, PointF end, params PointF[] additionalPoints)
49-
: this(new[] { start, controlPoint1, controlPoint2, end }.Merge(additionalPoints))
49+
: this(new[] { start, controlPoint1, controlPoint2, end }.Concat(additionalPoints))
5050
{
5151
}
5252

src/ImageSharp.Drawing/Helpers/ArrayExtensions.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,25 @@ namespace SixLabors.ImageSharp.Drawing.Helpers;
99
internal static class ArrayExtensions
1010
{
1111
/// <summary>
12-
/// Merges two arrays into one.
12+
/// Concatenates two arrays into one.
1313
/// </summary>
14-
/// <typeparam name="T">the type of the array</typeparam>
14+
/// <typeparam name="T">The element type.</typeparam>
1515
/// <param name="source1">The first source array.</param>
1616
/// <param name="source2">The second source array.</param>
1717
/// <returns>
18-
/// A new array containing the elements of both source arrays.
18+
/// A new array containing the elements of both source arrays, or <paramref name="source1"/>
19+
/// when <paramref name="source2"/> is empty.
1920
/// </returns>
20-
public static T[] Merge<T>(this T[] source1, T[] source2)
21+
public static T[] Concat<T>(this T[] source1, T[] source2)
2122
{
2223
if (source2 is null || source2.Length == 0)
2324
{
2425
return source1;
2526
}
2627

2728
T[] target = new T[source1.Length + source2.Length];
28-
29-
for (int i = 0; i < source1.Length; i++)
30-
{
31-
target[i] = source1[i];
32-
}
33-
34-
for (int i = 0; i < source2.Length; i++)
35-
{
36-
target[i + source1.Length] = source2[i];
37-
}
29+
source1.AsSpan().CopyTo(target);
30+
source2.AsSpan().CopyTo(target.AsSpan(source1.Length));
3831

3932
return target;
4033
}

src/ImageSharp.Drawing/InternalPath.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,13 @@ private static PointData[] Simplify(ReadOnlySpan<PointF> points, bool isClosed,
379379
}
380380

381381
/// <summary>
382-
/// Merges the specified source2.
382+
/// Determines whether two points are within the specified coordinate threshold of one another.
383383
/// </summary>
384-
/// <param name="source1">The source1.</param>
385-
/// <param name="source2">The source2.</param>
386-
/// <param name="threshold">The threshold.</param>
384+
/// <param name="source1">The first point.</param>
385+
/// <param name="source2">The second point.</param>
386+
/// <param name="threshold">The per-axis distance threshold.</param>
387387
/// <returns>
388-
/// the Merged arrays
388+
/// <see langword="true"/> when both coordinates are within <paramref name="threshold"/>; otherwise, <see langword="false"/>.
389389
/// </returns>
390390
[MethodImpl(MethodImplOptions.AggressiveInlining)]
391391
private static bool Equivalent(PointF source1, PointF source2, float threshold)

src/ImageSharp.Drawing/LinearLineSegment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public LinearLineSegment(PointF start, PointF end)
3434
/// <param name="point2">The point2.</param>
3535
/// <param name="additionalPoints">Additional points</param>
3636
public LinearLineSegment(PointF point1, PointF point2, params PointF[] additionalPoints)
37-
: this(new[] { point1, point2 }.Merge(additionalPoints))
37+
: this(new[] { point1, point2 }.Concat(additionalPoints))
3838
{
3939
}
4040

0 commit comments

Comments
 (0)