Use primary constructors in published projects

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-20 23:06:21 +01:00
1 親 531e3c3b35
コミット 46a6b25756
54ファイル変更
+210 -564

検索条件に一致するファイルはありません

+4 -12
ファイルの表示
@@ -10,7 +10,8 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Buffers;
/// <summary>
/// Represents a heap-based, array-backed output sink into which binary data can be written.
/// </summary>
internal ref struct ArrayPoolBinaryWriter
/// <param name="capacity">The initial capacity of the writer object.</param>
internal ref struct ArrayPoolBinaryWriter(int capacity)
{
/// <summary>
/// The default buffer size to use to expand empty arrays.
@@ -20,21 +21,12 @@ internal ref struct ArrayPoolBinaryWriter
/// <summary>
/// The underlying <see cref="byte"/> array.
/// </summary>
private byte[]? array;
private byte[]? array = ArrayPool<byte>.Shared.Rent(capacity);
/// <summary>
/// The starting offset within <see cref="array"/>.
/// </summary>
private int index;
/// <summary>
/// Initializes a new instance of the <see cref="ArrayPoolBinaryWriter"/> type.
/// </summary>
public ArrayPoolBinaryWriter(int capacity)
{
this.array = ArrayPool<byte>.Shared.Rent(capacity);
this.index = 0;
}
private int index = 0;
/// <summary>
/// Gets the data written to the underlying buffer so far, as a <see cref="ReadOnlySpan{T}"/>.
+2
ファイルの表示
@@ -1,5 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE0290
namespace ComputeSharp.D2D1.Interop;
/// <summary>
+2
ファイルの表示
@@ -1,5 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE0290
namespace ComputeSharp.D2D1.Interop;
/// <summary>
+7 -26
ファイルの表示
@@ -8,36 +8,17 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Helpers;
/// <summary>
/// A 64-bit version of the <see cref="Point"/> type.
/// </summary>
internal readonly struct Point64
/// <param name="x">The horizontal coordinate of the point.</param>
/// <param name="y">The vertical coordinate of the point.</param>
internal readonly struct Point64(long x, long y)
{
/// <summary>
/// The left coordinate of the current point.
/// </summary>
private readonly long x;
/// <summary>
/// The top coordinate of the current point.
/// </summary>
private readonly long y;
/// <summary>
/// Creates a new <see cref="Point64"/> instance with the specified parameters.
/// </summary>
/// <param name="x">The horizontal coordinate of the point.</param>
/// <param name="y">The vertical coordinate of the point.</param>
public Point64(long x, long y)
{
this.x = x;
this.y = y;
}
/// <summary>
/// Gets the horizontal coordinate of the current point.
/// </summary>
public readonly long X
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this.x;
get => x;
}
/// <summary>
@@ -46,7 +27,7 @@ internal readonly struct Point64
public readonly long Y
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this.y;
get => y;
}
/// <summary>
@@ -77,7 +58,7 @@ internal readonly struct Point64
// [ M21, M22 ]
// [ x, y] [ M31, M32 ] = [ x * M11 + y * M21 + M31, x * M12 + y * M22 + m32]
return (
Math.Round(((double)this.x * matrix.M11) + ((double)this.y * matrix.M21) + matrix.M31),
Math.Round(((double)this.x * matrix.M12) + ((double)this.y * matrix.M22) + matrix.M32));
Math.Round(((double)x * matrix.M11) + ((double)y * matrix.M21) + matrix.M31),
Math.Round(((double)x * matrix.M12) + ((double)y * matrix.M22) + matrix.M32));
}
}
+19 -37
ファイルの表示
@@ -7,42 +7,21 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Helpers;
/// <summary>
/// A 64-bit version of the <see cref="Rectangle"/> type.
/// </summary>
internal struct Rectangle64
/// <param name="x">The left coordinate of the rectangle.</param>
/// <param name="y">The top coordinate of the rectangle.</param>
/// <param name="width">The width of the rectangle.</param>
/// <param name="height">The height of the rectangle.</param>
internal struct Rectangle64(long x, long y, long width, long height)
{
/// <summary>
/// The left coordinate of the current rectangle.
/// </summary>
private long x;
private long x = x;
/// <summary>
/// The top coordinate of the current rectangle.
/// </summary>
private long y;
/// <summary>
/// The width of the current rectangle.
/// </summary>
private long width;
/// <summary>
/// The height of the current rectangle.
/// </summary>
private long height;
/// <summary>
/// Creates a new <see cref="Rectangle64"/> instance with the specified parameters.
/// </summary>
/// <param name="x">The left coordinate of the rectangle.</param>
/// <param name="y">The top coordinate of the rectangle.</param>
/// <param name="width">The width of the rectangle.</param>
/// <param name="height">The height of the rectangle.</param>
public Rectangle64(long x, long y, long width, long height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
private long y = y;
/// <summary>
/// Gets the left coordinate of the current rectangle.
@@ -68,7 +47,7 @@ internal struct Rectangle64
public readonly long Right
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this.x + this.width;
get => this.x + width;
}
/// <summary>
@@ -77,7 +56,7 @@ internal struct Rectangle64
public readonly long Bottom
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this.y + this.height;
get => this.y + height;
}
/// <summary>
@@ -102,8 +81,9 @@ internal struct Rectangle64
this.x = left;
this.y = top;
this.width = right - left;
this.height = bottom - top;
width = right - left;
height = bottom - top;
}
/// <summary>
@@ -119,8 +99,9 @@ internal struct Rectangle64
this.x = left;
this.y = top;
this.width = Math.Max(right - left, 0);
this.height = Math.Max(bottom - top, 0);
width = Math.Max(right - left, 0);
height = Math.Max(bottom - top, 0);
}
/// <summary>
@@ -134,8 +115,9 @@ internal struct Rectangle64
{
this.x -= left;
this.y -= top;
this.width += left + right;
this.height += top + bottom;
width += left + right;
height += top + bottom;
}
/// <summary>
@@ -146,7 +128,7 @@ internal struct Rectangle64
{
Intersect(new Rectangle64(int.MinValue / 2, int.MinValue / 2, int.MaxValue, int.MaxValue));
return new((int)this.x, (int)this.y, (int)this.width, (int)this.height);
return new((int)this.x, (int)this.y, (int)width, (int)height);
}
/// <summary>