Fix ref usage warnings with in-parameters

This commit is contained in:
2025-12-06 00:36:28 +02:00
parent 74bac97f44
commit ecf074801f
83 changed files with 185 additions and 185 deletions

View File

@@ -261,7 +261,7 @@ namespace FlaxEngine.GUI
var rect = new Rectangle(margin.Location, Size - margin.Size);
if (ClipText)
Render2D.PushClip(ref rect);
Render2D.PushClip(rect);
var color = IsMouseOver || IsNavFocused ? TextColorHighlighted : TextColor;
if (!EnabledInHierarchy)
@@ -326,7 +326,7 @@ namespace FlaxEngine.GUI
layout.Bounds.Size.X = Width - Margin.Width;
else if (_autoWidth && !_autoHeight)
layout.Bounds.Size.Y = Height - Margin.Height;
_textSize = font.MeasureText(text, ref layout);
_textSize = font.MeasureText(text, layout);
_textSize.Y *= BaseLinesGapScale;
// Check if size is controlled via text

View File

@@ -257,7 +257,7 @@ namespace FlaxEngine.GUI
case BarMethod.Clip:
var rect = new Rectangle(0, 0, Width, Height);
BarMargin.ShrinkRectangle(ref rect);
Render2D.PushClip(ref barRect);
Render2D.PushClip(barRect);
if (BarBrush != null)
BarBrush.Draw(rect, BarColor);
else

View File

@@ -90,7 +90,7 @@ namespace FlaxEngine.GUI
if (_texture.Size != _textureSize)
{
var desc = GPUTextureDescription.New2D((int)_textureSize.X, (int)_textureSize.Y, PixelFormat.R8G8B8A8_UNorm);
if (_texture.Init(ref desc))
if (_texture.Init(desc))
{
Debug.Logger.LogHandler.LogWrite(LogType.Error, "Failed to allocate texture for RenderToTextureControl");
return;
@@ -108,7 +108,7 @@ namespace FlaxEngine.GUI
{
var scale = _textureSize / Size;
Matrix3x3.Scaling(scale.X, scale.Y, 1.0f, out var scaleMatrix);
Render2D.PushTransform(ref scaleMatrix);
Render2D.PushTransform(scaleMatrix);
Draw();
Render2D.PopTransform();
}

View File

@@ -188,7 +188,7 @@ namespace FlaxEngine.GUI
var font = textBlock.Style.Font.GetFont();
if (!font)
return;
var lines = font.ProcessText(_text, ref textBlock.Range);
var lines = font.ProcessText(_text, textBlock.Range);
if (lines == null || lines.Length == 0)
return;
for (int i = 0; i < lines.Length; i++)

View File

@@ -205,7 +205,7 @@ namespace FlaxEngine.GUI
if (!font)
break;
height = font.Height / DpiScale;
return textBlock.Bounds.Location + font.GetCharPosition(_text, ref textBlock.Range, index - textBlock.Range.StartIndex);
return textBlock.Bounds.Location + font.GetCharPosition(_text, textBlock.Range, index - textBlock.Range.StartIndex);
}
}
@@ -247,7 +247,7 @@ namespace FlaxEngine.GUI
var font = textBlock.Style.Font.GetFont();
if (!font && textBlock.Range.Length > 0)
break;
return font.HitTestText(_text, ref textBlock.Range, location - textBlock.Bounds.Location) + textBlock.Range.StartIndex;
return font.HitTestText(_text, textBlock.Range, location - textBlock.Bounds.Location) + textBlock.Range.StartIndex;
}
}
@@ -404,14 +404,14 @@ namespace FlaxEngine.GUI
color = textBlock.Style.ShadowColor;
if (!enabled)
color *= 0.6f;
Render2D.DrawText(font, _text, ref textBlock.Range, color, textBlock.Bounds.Location + textBlock.Style.ShadowOffset, textBlock.Style.CustomMaterial);
Render2D.DrawText(font, _text, textBlock.Range, color, textBlock.Bounds.Location + textBlock.Style.ShadowOffset, textBlock.Style.CustomMaterial);
}
// Text
color = textBlock.Style.Color;
if (!enabled)
color *= 0.6f;
Render2D.DrawText(font, _text, ref textBlock.Range, color, textBlock.Bounds.Location, textBlock.Style.CustomMaterial);
Render2D.DrawText(font, _text, textBlock.Range, color, textBlock.Bounds.Location, textBlock.Style.CustomMaterial);
}
// Draw underline

View File

@@ -381,7 +381,7 @@ public class Slider : ContainerControl
// Draw track fill
if (FillTrack)
{
Render2D.PushClip(ref fillLineRect);
Render2D.PushClip(fillLineRect);
if (FillTrackBrush != null)
FillTrackBrush.Draw(lineRect, TrackFillLineColor);
else

View File

@@ -154,7 +154,7 @@ namespace FlaxEngine.GUI
return Float2.Zero;
}
return font.MeasureText(ConvertedText(), ref _layout);
return font.MeasureText(ConvertedText(), _layout);
}
private Font GetFont()
@@ -198,7 +198,7 @@ namespace FlaxEngine.GUI
}
height = font.Height / DpiScale;
return font.GetCharPosition(ConvertedText(), index, ref _layout);
return font.GetCharPosition(ConvertedText(), index, _layout);
}
/// <inheritdoc />
@@ -210,7 +210,7 @@ namespace FlaxEngine.GUI
return 0;
}
return font.HitTestText(ConvertedText(), location, ref _layout);
return font.HitTestText(ConvertedText(), location, _layout);
}
/// <inheritdoc />
@@ -251,8 +251,8 @@ namespace FlaxEngine.GUI
// Check if sth is selected to draw selection
if (HasSelection && IsFocused)
{
var leftEdge = font.GetCharPosition(text, SelectionLeft, ref _layout);
var rightEdge = font.GetCharPosition(text, SelectionRight, ref _layout);
var leftEdge = font.GetCharPosition(text, SelectionLeft, _layout);
var rightEdge = font.GetCharPosition(text, SelectionRight, _layout);
var fontHeight = font.Height;
var textHeight = fontHeight / DpiScale;
@@ -296,14 +296,14 @@ namespace FlaxEngine.GUI
color *= 0.6f;
else if (_isReadOnly)
color *= 0.85f;
Render2D.DrawText(font, text, color, ref _layout, TextMaterial);
Render2D.DrawText(font, text, color, _layout, TextMaterial);
}
else
{
text = _watermarkText;
if (text?.Length > 0)
{
Render2D.DrawText(font, _watermarkText, WatermarkTextColor, ref _layout, TextMaterial);
Render2D.DrawText(font, _watermarkText, WatermarkTextColor, _layout, TextMaterial);
}
}