mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-29 09:18:01 +01:00
Reference passing to avoid some struct copies
This commit is contained in:
@@ -520,7 +520,7 @@ public abstract class ConsoleDriver
|
||||
/// <param name="foreground">The foreground color.</param>
|
||||
/// <param name="background">The background color.</param>
|
||||
/// <returns>The attribute for the foreground and background colors.</returns>
|
||||
public virtual Attribute MakeColor (Color foreground, Color background)
|
||||
public virtual Attribute MakeColor (in Color foreground, in Color background)
|
||||
{
|
||||
// Encode the colors into the int value.
|
||||
return new Attribute (
|
||||
|
||||
@@ -835,7 +835,7 @@ internal class CursesDriver : ConsoleDriver
|
||||
/// bits, and the background color is stored in the least significant 4 bits. The Terminal.GUi Color values are
|
||||
/// converted to curses color encoding before being encoded.
|
||||
/// </remarks>
|
||||
public override Attribute MakeColor (Color foreground, Color background)
|
||||
public override Attribute MakeColor (in Color foreground, in Color background)
|
||||
{
|
||||
if (!RunningUnitTests)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ public readonly struct Attribute : IEquatable<Attribute>, IEqualityOperators<Att
|
||||
/// <summary>Initializes a new instance of the <see cref="Attribute"/> struct.</summary>
|
||||
/// <param name="foreground">Foreground</param>
|
||||
/// <param name="background">Background</param>
|
||||
public Attribute (Color foreground, Color background)
|
||||
public Attribute (in Color foreground, in Color background)
|
||||
{
|
||||
Foreground = foreground;
|
||||
Background = background;
|
||||
@@ -94,10 +94,8 @@ public readonly struct Attribute : IEquatable<Attribute>, IEqualityOperators<Att
|
||||
/// <summary>Initializes a new instance of the <see cref="Attribute"/> struct.</summary>
|
||||
/// <param name="foregroundName">Foreground</param>
|
||||
/// <param name="backgroundName">Background</param>
|
||||
public Attribute (in ColorName foregroundName, in ColorName backgroundName) : this (
|
||||
new Color (foregroundName),
|
||||
new Color (backgroundName)
|
||||
)
|
||||
public Attribute (in ColorName foregroundName, in ColorName backgroundName)
|
||||
: this (new Color (in foregroundName), new Color (in backgroundName))
|
||||
{ }
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="Attribute"/> struct.</summary>
|
||||
|
||||
Reference in New Issue
Block a user