Fix ref usage warnings with in-parameters
This commit is contained in:
@@ -499,7 +499,7 @@ namespace FlaxEngine
|
||||
}
|
||||
bounds = new BoundingBox(min, max);
|
||||
}
|
||||
mesh.SetBounds(ref bounds);
|
||||
mesh.SetBounds(bounds);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace FlaxEngine
|
||||
Direction = camera.Direction;
|
||||
Near = camera.NearPlane;
|
||||
Far = camera.FarPlane;
|
||||
camera.GetMatrices(out View, out Projection, ref viewport, ref Origin);
|
||||
camera.GetMatrices(out View, out Projection, viewport, Origin);
|
||||
NonJitteredProjection = Projection;
|
||||
TemporalAAJitter = Float4.Zero;
|
||||
RenderLayersMask = camera.RenderLayersMask;
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace FlaxEngine
|
||||
internal void Internal_OnDraw()
|
||||
{
|
||||
Matrix3x3.Scaling(DpiScale, out var scale);
|
||||
Render2D.PushTransform(ref scale);
|
||||
Render2D.PushTransform(scale);
|
||||
GUI.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace FlaxEngine
|
||||
Scale = scale,
|
||||
BaseLinesGapScale = baseLinesGapScale,
|
||||
};
|
||||
DrawText(font, text, color, ref layout);
|
||||
DrawText(font, text, color, layout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,7 +149,7 @@ namespace FlaxEngine
|
||||
Scale = scale,
|
||||
BaseLinesGapScale = baseLinesGapScale,
|
||||
};
|
||||
DrawText(font, text, color, ref layout, customMaterial);
|
||||
DrawText(font, text, color, layout, customMaterial);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -195,7 +195,7 @@ namespace FlaxEngine
|
||||
throw new InvalidOperationException("Output buffer and depth buffer dimensions must be equal.");
|
||||
}
|
||||
|
||||
Begin(context, output, depthBuffer, ref viewProjection);
|
||||
Begin(context, output, depthBuffer, viewProjection);
|
||||
try
|
||||
{
|
||||
drawableElement.Draw();
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace FlaxEngine
|
||||
throw new InvalidOperationException("Cannot use invalid sprite.");
|
||||
var sprite = Atlas.GetSprite(Index);
|
||||
sprite.Name = value;
|
||||
Atlas.SetSprite(Index, ref sprite);
|
||||
Atlas.SetSprite(Index, sprite);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace FlaxEngine
|
||||
throw new InvalidOperationException("Cannot use invalid sprite.");
|
||||
var sprite = Atlas.GetSprite(Index);
|
||||
sprite.Area = value;
|
||||
Atlas.SetSprite(Index, ref sprite);
|
||||
Atlas.SetSprite(Index, sprite);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace FlaxEngine
|
||||
temp = CollectionsMarshal.AsSpan(customActors).ToArray(); // FIXME
|
||||
tempCount = temp.Length;
|
||||
}
|
||||
Internal_DrawSceneDepth(FlaxEngine.Object.GetUnmanagedPtr(context), FlaxEngine.Object.GetUnmanagedPtr(task), FlaxEngine.Object.GetUnmanagedPtr(output), temp, ref tempCount);
|
||||
Internal_DrawSceneDepth(FlaxEngine.Object.GetUnmanagedPtr(context), FlaxEngine.Object.GetUnmanagedPtr(task), FlaxEngine.Object.GetUnmanagedPtr(output), temp, tempCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,7 +42,7 @@ namespace FlaxEngine
|
||||
temp = CollectionsMarshal.AsSpan(customActors).ToArray(); // FIXME
|
||||
tempCount = temp.Length;
|
||||
}
|
||||
Internal_DrawActors(ref renderContext, temp, ref tempCount);
|
||||
Internal_DrawActors(ref renderContext, temp, tempCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace FlaxEngine
|
||||
{
|
||||
fixed (byte* holesMaskPtr = holesMask)
|
||||
{
|
||||
return SetupPatchHeightMap(ref patchCoord, heightMap.Length, heightMapPtr, holesMaskPtr, forceUseVirtualStorage);
|
||||
return SetupPatchHeightMap(patchCoord, heightMap.Length, heightMapPtr, holesMaskPtr, forceUseVirtualStorage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ namespace FlaxEngine
|
||||
|
||||
fixed (Color32* splatMapPtr = splatMap)
|
||||
{
|
||||
return SetupPatchSplatMap(ref patchCoord, index, splatMap.Length, splatMapPtr, forceUseVirtualStorage);
|
||||
return SetupPatchSplatMap(patchCoord, index, splatMap.Length, splatMapPtr, forceUseVirtualStorage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace FlaxEngine.GUI
|
||||
if (ClipChildren)
|
||||
{
|
||||
GetDesireClientArea(out var clientArea);
|
||||
Render2D.PushClip(ref clientArea);
|
||||
Render2D.PushClip(clientArea);
|
||||
DrawChildren();
|
||||
Render2D.PopClip();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -802,7 +802,7 @@ namespace FlaxEngine.GUI
|
||||
if (_clipChildren)
|
||||
{
|
||||
GetDesireClientArea(out var clientArea);
|
||||
Render2D.PushClip(ref clientArea);
|
||||
Render2D.PushClip(clientArea);
|
||||
DrawChildren();
|
||||
Render2D.PopClip();
|
||||
}
|
||||
@@ -840,7 +840,7 @@ namespace FlaxEngine.GUI
|
||||
var childGlobalRect = new Rectangle(globalChildTransform.M31, globalChildTransform.M32, child.Width * globalChildTransform.M11, child.Height * globalChildTransform.M22);
|
||||
if (globalClipping.Intersects(ref childGlobalRect))
|
||||
{
|
||||
Render2D.PushTransform(ref child._cachedTransform);
|
||||
Render2D.PushTransform(child._cachedTransform);
|
||||
child.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
@@ -854,7 +854,7 @@ namespace FlaxEngine.GUI
|
||||
var child = children[i];
|
||||
if (child.Visible)
|
||||
{
|
||||
Render2D.PushTransform(ref child._cachedTransform);
|
||||
Render2D.PushTransform(child._cachedTransform);
|
||||
child.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ namespace FlaxEngine.GUI
|
||||
if (IgnoreStack)
|
||||
{
|
||||
Color newColor = new Color(oldColor.R, oldColor.G, oldColor.B, Alpha);
|
||||
Render2D.PushTint(ref newColor, false);
|
||||
Render2D.PushTint(newColor, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color newColor = new Color(oldColor.R, oldColor.G, oldColor.B, oldColor.A * Alpha);
|
||||
Render2D.PushTint(ref newColor, false);
|
||||
Render2D.PushTint(newColor, false);
|
||||
}
|
||||
|
||||
base.Draw();
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace FlaxEngine.GUI
|
||||
var child = _children[i];
|
||||
if (!child.IsScrollable && child.Visible)
|
||||
{
|
||||
Render2D.PushTransform(ref child._cachedTransform);
|
||||
Render2D.PushTransform(child._cachedTransform);
|
||||
child.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
@@ -439,7 +439,7 @@ namespace FlaxEngine.GUI
|
||||
{
|
||||
// Draw children with clipping mask (so none of the controls will override the header)
|
||||
Rectangle clipMask = new Rectangle(0, HeaderHeight, Width, Height - HeaderHeight);
|
||||
Render2D.PushClip(ref clipMask);
|
||||
Render2D.PushClip(clipMask);
|
||||
if (CullChildren)
|
||||
{
|
||||
Render2D.PeekClip(out var globalClipping);
|
||||
@@ -453,7 +453,7 @@ namespace FlaxEngine.GUI
|
||||
var childGlobalRect = new Rectangle(globalChildTransform.M31, globalChildTransform.M32, child.Width * globalChildTransform.M11, child.Height * globalChildTransform.M22);
|
||||
if (globalClipping.Intersects(ref childGlobalRect))
|
||||
{
|
||||
Render2D.PushTransform(ref child._cachedTransform);
|
||||
Render2D.PushTransform(child._cachedTransform);
|
||||
child.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
@@ -467,7 +467,7 @@ namespace FlaxEngine.GUI
|
||||
var child = _children[i];
|
||||
if (child.IsScrollable && child.Visible)
|
||||
{
|
||||
Render2D.PushTransform(ref child._cachedTransform);
|
||||
Render2D.PushTransform(child._cachedTransform);
|
||||
child.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
|
||||
@@ -439,14 +439,14 @@ namespace FlaxEngine.GUI
|
||||
// Draw scrollbars manually (they are outside the clipping bounds)
|
||||
if (VScrollBar != null && VScrollBar.Visible)
|
||||
{
|
||||
Render2D.PushTransform(ref VScrollBar._cachedTransform);
|
||||
Render2D.PushTransform(VScrollBar._cachedTransform);
|
||||
VScrollBar.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
|
||||
if (HScrollBar != null && HScrollBar.Visible)
|
||||
{
|
||||
Render2D.PushTransform(ref HScrollBar._cachedTransform);
|
||||
Render2D.PushTransform(HScrollBar._cachedTransform);
|
||||
HScrollBar.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace FlaxEngine.GUI
|
||||
|
||||
// Resize backbuffer
|
||||
var desc = GPUTextureDescription.New2D(width, height, BackBufferFormat);
|
||||
_backBuffer.Init(ref desc);
|
||||
_backBuffer.Init(desc);
|
||||
_task.Output = _backBuffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace FlaxEngine.GUI
|
||||
transform.M32 += _viewOffset.Y;
|
||||
}
|
||||
|
||||
Render2D.PushTransform(ref transform);
|
||||
Render2D.PushTransform(transform);
|
||||
child.Draw();
|
||||
Render2D.PopTransform();
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace FlaxEngine.GUI
|
||||
layout.HorizontalAlignment = TextAlignment.Center;
|
||||
layout.VerticalAlignment = TextAlignment.Center;
|
||||
layout.TextWrapping = TextWrapping.WrapWords;
|
||||
var items = style.FontMedium.ProcessText(_currentText, ref layout);
|
||||
var items = style.FontMedium.ProcessText(_currentText, layout);
|
||||
for (int i = 0; i < items.Length; i++)
|
||||
{
|
||||
ref var item = ref items[i];
|
||||
|
||||
@@ -455,7 +455,7 @@ namespace FlaxEngine
|
||||
var viewport = camera.Viewport;
|
||||
if (camera.UsePerspective)
|
||||
{
|
||||
camera.GetMatrices(out tmp1, out var tmp3, ref viewport);
|
||||
camera.GetMatrices(out tmp1, out var tmp3, viewport);
|
||||
Matrix.Multiply(ref tmp1, ref tmp3, out tmp2);
|
||||
var frustum = new BoundingFrustum(ref tmp2);
|
||||
_guiRoot.Size = new Float2(frustum.GetWidthAtDepth(Distance), frustum.GetHeightAtDepth(Distance));
|
||||
|
||||
Reference in New Issue
Block a user