diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs
index 0e134c512..f7e75d5a1 100644
--- a/Terminal.Gui/View/Adornment/Adornment.cs
+++ b/Terminal.Gui/View/Adornment/Adornment.cs
@@ -135,7 +135,7 @@ public class Adornment : View
}
///
- public override Point ScreenToFrame (Point location)
+ public override Point ScreenToFrame (in Point location)
{
return Parent.ScreenToFrame (new (location.X - Frame.X, location.Y - Frame.Y));
}
diff --git a/Terminal.Gui/View/Layout/ViewLayout.cs b/Terminal.Gui/View/Layout/ViewLayout.cs
index d10e13e2e..9af05e4c4 100644
--- a/Terminal.Gui/View/Layout/ViewLayout.cs
+++ b/Terminal.Gui/View/Layout/ViewLayout.cs
@@ -88,15 +88,13 @@ public partial class View
}
}
- private void SetFrame (Rectangle frame)
+ private void SetFrame (in Rectangle frame)
{
var oldViewport = Rectangle.Empty;
- Size? oldContentSize = null;
if (IsInitialized)
{
oldViewport = Viewport;
- oldContentSize = ContentSize;
}
// This is the only place where _frame should be set directly. Use Frame = or SetFrame instead.
@@ -148,7 +146,7 @@ public partial class View
///
/// The coordinate relative to the 's .
/// Screen-relative coordinate.
- public virtual Point ScreenToFrame (Point location)
+ public virtual Point ScreenToFrame (in Point location)
{
if (SuperView is null)
{
@@ -156,15 +154,13 @@ public partial class View
}
Point superViewViewportOffset = SuperView.GetViewportOffsetFromFrame ();
- superViewViewportOffset.X -= SuperView.Viewport.X;
- superViewViewportOffset.Y -= SuperView.Viewport.Y;
+ superViewViewportOffset.Offset(-SuperView.Viewport.X, -SuperView.Viewport.Y);
- location.X -= superViewViewportOffset.X;
- location.Y -= superViewViewportOffset.Y;
+ Point frame = location;
+ frame.Offset(-superViewViewportOffset.X, -superViewViewportOffset.Y);
- Point frame = SuperView.ScreenToFrame (location);
- frame.X -= Frame.X;
- frame.Y -= Frame.Y;
+ frame = SuperView.ScreenToFrame (frame);
+ frame.Offset (-Frame.X, -Frame.Y);
return frame;
}