Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ private void InitializeManipulationState(Int64 timestamp)
/// <param name="expansion">the new expansion</param>
/// <param name="orientation">the new orientation</param>
/// <param name="timestamp">the time of the new values</param>
private void OverwriteManipulationState(PointF position, float scale, float expansion, float orientation, Int64 timestamp)
private void OverwriteManipulationState(in PointF position, float scale, float expansion, float orientation, Int64 timestamp)
{
this.currentManipulationState = new ManipulationState(position, scale, expansion, orientation, timestamp);
#if DEBUG
Expand Down Expand Up @@ -1033,7 +1033,7 @@ private PointF GetAveragePoint()
/// </summary>
/// <param name="referenceOrigin">the common point of reference</param>
/// <param name="settings">manipulation settings</param>
private void SetVectorsFromPoint(PointF referenceOrigin, ISettings settings)
private void SetVectorsFromPoint(in PointF referenceOrigin, ISettings settings)
{
Debug.Assert(this.manipulatorStates != null && this.manipulatorStates.Count > 0);

Expand Down Expand Up @@ -1549,7 +1549,7 @@ private struct ManipulationState
public readonly float Orientation;
public Int64 Timestamp;

public ManipulationState(PointF position, float scale, float expansion, float orientation, Int64 timestamp)
public ManipulationState(in PointF position, float scale, float expansion, float orientation, Int64 timestamp)
{
Debug.Assert(!float.IsNaN(position.X) && !float.IsNaN(position.Y));
Debug.Assert(!float.IsInfinity(position.Y) && !float.IsInfinity(position.Y));
Expand Down Expand Up @@ -1589,4 +1589,4 @@ private enum ProcessorState
#endregion Private Classes

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace System.Windows.Input.Manipulations
/// two floats everywhere, but I just couldn't take it any more. A point class is just
/// too nice a thing.
/// </summary>
internal struct PointF
internal readonly struct PointF
{
private float x;
private float y;
private readonly float x;
private readonly float y;

/// <summary>
/// Create a basic point structure
Expand All @@ -36,7 +36,7 @@ public PointF(float x, float y)
/// <param name="point">The point to convert.</param>
/// <returns>A VectorF structure with an X value equal to this point's X value
/// and a Y value equal to this point's Y value.</returns>
public static explicit operator VectorF(PointF point)
public static explicit operator VectorF(in PointF point)
{
return new VectorF(point.x, point.y);
}
Expand All @@ -47,7 +47,7 @@ public static explicit operator VectorF(PointF point)
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
public static bool operator !=(PointF left, PointF right)
public static bool operator !=(in PointF left, in PointF right)
{
return left.X != right.X || left.Y != right.Y;
}
Expand All @@ -61,7 +61,7 @@ public static explicit operator VectorF(PointF point)
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
public static bool operator ==(PointF left, PointF right)
public static bool operator ==(in PointF left, in PointF right)
{
return left.X == right.X && left.Y == right.Y;
}
Expand All @@ -73,7 +73,7 @@ public static explicit operator VectorF(PointF point)
/// <param name="pt">The point to translate.</param>
/// <param name="offset">The amount by which to translate the point.</param>
/// <returns>The result of translating the specified point by the specified vector.</returns>
public static PointF operator +(PointF pt, VectorF offset)
public static PointF operator +(in PointF pt, VectorF offset)
{
return new PointF(pt.X + offset.X, pt.Y + offset.Y);
}
Expand All @@ -85,7 +85,7 @@ public static explicit operator VectorF(PointF point)
/// <param name="point1">The point from which point2 is subtracted.</param>
/// <param name="point2">The point to subtract from point1.</param>
/// <returns>The difference between point1 and point2.</returns>
public static VectorF operator -(PointF point1, PointF point2)
public static VectorF operator -(in PointF point1, in PointF point2)
{
return new VectorF(point1.x - point2.x, point1.y - point2.y);
}
Expand All @@ -97,7 +97,7 @@ public static explicit operator VectorF(PointF point)
/// <param name="point">The point from which vector is subtracted.</param>
/// <param name="vector">The vector to subtract from point</param>
/// <returns>The difference between point and vector.</returns>
public static PointF operator -(PointF point, VectorF vector)
public static PointF operator -(in PointF point, VectorF vector)
{
return new PointF(point.x - vector.X, point.y - vector.Y);
}
Expand Down