(MAJOR) Removed all in paramters as their performance impact is too hard to predict

This commit is contained in:
DarthAffe committed 2024-07-21 23:10:56 +02:00
1 parent 6f0711564c
commit c39849949a
38 files changed
+157 -155

No files matched your search

+1 -1
View File
@@ -90,7 +90,7 @@ public sealed class FlashDecorator : AbstractUpdateAwareDecorator, IBrushDecorat
#region Methods
/// <inheritdoc />
public void ManipulateColor(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color) => color = color.SetA(_currentValue);
public void ManipulateColor(Rectangle rectangle, RenderTarget renderTarget, ref Color color) => color = color.SetA(_currentValue);
/// <inheritdoc />
protected override void Update(double deltaTime)
+3 -3
View File
@@ -20,7 +20,7 @@ public static class GradientHelper
/// <param name="endPoint">The end <see cref="Point"/> of the gradient.</param>
/// <param name="point">The <see cref="Point"/> on the gradient to which the offset is calculated.</param>
/// <returns>The offset of the <see cref="Point"/> on the gradient.</returns>
public static float CalculateLinearGradientOffset(in Point startPoint, in Point endPoint, in Point point)
public static float CalculateLinearGradientOffset(Point startPoint, Point endPoint, Point point)
{
Point intersectingPoint;
if (startPoint.Y.EqualsInTolerance(endPoint.Y)) // Horizontal case
@@ -57,7 +57,7 @@ public static class GradientHelper
/// <param name="origin">The origin of the vector.</param>
/// <param name="direction">The direction of the vector.</param>
/// <returns>The signed magnitude of a <see cref="Point"/> on a vector.</returns>
public static float CalculateDistance(in Point point, in Point origin, in Point direction)
public static float CalculateDistance(Point point, Point origin, Point direction)
{
float distance = CalculateDistance(point, origin);
@@ -74,7 +74,7 @@ public static class GradientHelper
/// <param name="point1">The first <see cref="Point"/>.</param>
/// <param name="point2">The second <see cref="Point"/>.</param>
/// <returns>The distance between the two <see cref="Point"/>.</returns>
public static float CalculateDistance(in Point point1, in Point point2)
public static float CalculateDistance(Point point1, Point point2)
{
float x = point1.X - point2.X;
float y = point1.Y - point2.Y;
@@ -21,10 +21,10 @@ public abstract class AbstractGradientTexture : AbstractBindable, ITexture
public Size Size { get; }
/// <inheritdoc />
public Color this[in Point point] => GetColor(point);
public Color this[Point point] => GetColor(point);
/// <inheritdoc />
public Color this[in Rectangle rectangle] => GetColor(rectangle.Center);
public Color this[Rectangle rectangle] => GetColor(rectangle.Center);
#endregion
@@ -50,7 +50,7 @@ public abstract class AbstractGradientTexture : AbstractBindable, ITexture
/// </summary>
/// <param name="point">The location to get the color from.</param>
/// <returns>The color at the specified location.</returns>
protected abstract Color GetColor(in Point point);
protected abstract Color GetColor(Point point);
#endregion
}
@@ -88,7 +88,7 @@ public sealed class ConicalGradientTexture : AbstractGradientTexture
#region Methods
/// <inheritdoc />
protected override Color GetColor(in Point point)
protected override Color GetColor(Point point)
{
float angle = MathF.Atan2(point.Y - Center.Y, point.X - Center.X) - Origin;
if (angle < 0) angle += PI2;
@@ -71,7 +71,7 @@ public sealed class LinearGradientTexture : AbstractGradientTexture
#region Methods
/// <inheritdoc />
protected override Color GetColor(in Point point)
protected override Color GetColor(Point point)
{
float offset = GradientHelper.CalculateLinearGradientOffset(StartPoint, EndPoint, point);
return Gradient.GetColor(offset);
@@ -69,7 +69,7 @@ public sealed class RadialGradientTexture : AbstractGradientTexture
}
/// <inheritdoc />
protected override Color GetColor(in Point point)
protected override Color GetColor(Point point)
{
float distance = GradientHelper.CalculateDistance(point, Center);
float offset = distance / _referenceDistance;
@@ -18,7 +18,7 @@ public sealed class AverageByteSampler : ISampler<byte>
#region Methods
/// <inheritdoc />
public unsafe void Sample(in SamplerInfo<byte> info, Span<byte> pixelData)
public unsafe void Sample(SamplerInfo<byte> info, Span<byte> pixelData)
{
int count = info.Width * info.Height;
if (count == 0) return;
@@ -12,7 +12,7 @@ public sealed class AverageFloatSampler : ISampler<float>
#region Methods
/// <inheritdoc />
public unsafe void Sample(in SamplerInfo<float> info, Span<float> pixelData)
public unsafe void Sample(SamplerInfo<float> info, Span<float> pixelData)
{
int count = info.Width * info.Height;
if (count == 0) return;