From 326749498bed4360e5a4b11fc67d5ec7cb9a3076 Mon Sep 17 00:00:00 2001
From: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
Date: Sun, 16 Jul 2023 19:31:14 +0200
Subject: [Ryujinx.HLE] Address dotnet-format issues (#5380)

* dotnet format style --severity info

Some changes were manually reverted.

* dotnet format analyzers --serverity info

Some changes have been minimally adapted.

* Restore a few unused methods and variables

* Silence dotnet format IDE0060 warnings

* Silence dotnet format IDE0052 warnings

* Address or silence dotnet format IDE1006 warnings

* Address dotnet format CA1816 warnings

* Address or silence dotnet format CA2208 warnings

* Address or silence dotnet format CA1806 and a few CA1854 warnings

* Address dotnet format CA2211 warnings

* Address dotnet format CA1822 warnings

* Address or silence dotnet format CA1069 warnings

* Make dotnet format succeed in style mode

* Address or silence dotnet format CA2211 warnings

* Address review comments

* Address dotnet format CA2208 warnings properly

* Make ProcessResult readonly

* Address most dotnet format whitespace warnings

* Apply dotnet format whitespace formatting

A few of them have been manually reverted and the corresponding warning was silenced

* Add previously silenced warnings back

I have no clue how these disappeared

* Revert formatting changes for while and for-loops

* Format if-blocks correctly

* Run dotnet format style after rebase

* Run dotnet format whitespace after rebase

* Run dotnet format style after rebase

* Run dotnet format analyzers after rebase

* Run dotnet format after rebase and remove unused usings

- analyzers
- style
- whitespace

* Disable 'prefer switch expression' rule

* Add comments to disabled warnings

* Fix a few disabled warnings

* Fix naming rule violation, Convert shader properties to auto-property and convert values to const

* Simplify properties and array initialization, Use const when possible, Remove trailing commas

* Start working on disabled warnings

* Fix and silence a few dotnet-format warnings again

* Run dotnet format after rebase

* Use using declaration instead of block syntax

* Address IDE0251 warnings

* Address a few disabled IDE0060 warnings

* Silence IDE0060 in .editorconfig

* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"

This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.

* dotnet format whitespace after rebase

* First dotnet format pass

* Fix naming rule violations

* Fix typo

* Add trailing commas, use targeted new and use array initializer

* Fix build issues

* Fix remaining build issues

* Remove SuppressMessage for CA1069 where possible

* Address dotnet format issues

* Address formatting issues

Co-authored-by: Ac_K <acoustik666@gmail.com>

* Add GetHashCode implementation for RenderingSurfaceInfo

* Explicitly silence CA1822 for every affected method in Syscall

* Address formatting issues in Demangler.cs

* Address review feedback

Co-authored-by: Ac_K <acoustik666@gmail.com>

* Revert marking service methods as static

* Next dotnet format pass

* Address review feedback

---------

Co-authored-by: Ac_K <acoustik666@gmail.com>
---
 .../SoftwareKeyboardRendererBase.cs                | 210 ++++++++++-----------
 1 file changed, 104 insertions(+), 106 deletions(-)

(limited to 'src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs')

diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs
index 595223ed..770bf6e5 100644
--- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs
+++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs
@@ -21,47 +21,47 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
     {
         public const int TextBoxBlinkThreshold = 8;
 
-        const string MessageText          = "Please use the keyboard to input text";
-        const string AcceptText           = "Accept";
-        const string CancelText           = "Cancel";
+        const string MessageText = "Please use the keyboard to input text";
+        const string AcceptText = "Accept";
+        const string CancelText = "Cancel";
         const string ControllerToggleText = "Toggle input";
 
         private readonly object _bufferLock = new();
 
         private RenderingSurfaceInfo _surfaceInfo = null;
-        private Image<Argb32>        _surface     = null;
-        private byte[]               _bufferData  = null;
+        private Image<Argb32> _surface = null;
+        private byte[] _bufferData = null;
 
-        private Image _ryujinxLogo   = null;
-        private Image _padAcceptIcon = null;
-        private Image _padCancelIcon = null;
-        private Image _keyModeIcon   = null;
+        private readonly Image _ryujinxLogo = null;
+        private readonly Image _padAcceptIcon = null;
+        private readonly Image _padCancelIcon = null;
+        private readonly Image _keyModeIcon = null;
 
-        private float _textBoxOutlineWidth;
-        private float _padPressedPenWidth;
+        private readonly float _textBoxOutlineWidth;
+        private readonly float _padPressedPenWidth;
 
-        private Color _textNormalColor;
-        private Color _textSelectedColor;
-        private Color _textOverCursorColor;
+        private readonly Color _textNormalColor;
+        private readonly Color _textSelectedColor;
+        private readonly Color _textOverCursorColor;
 
-        private IBrush _panelBrush;
-        private IBrush _disabledBrush;
-        private IBrush _cursorBrush;
-        private IBrush _selectionBoxBrush;
+        private readonly IBrush _panelBrush;
+        private readonly IBrush _disabledBrush;
+        private readonly IBrush _cursorBrush;
+        private readonly IBrush _selectionBoxBrush;
 
-        private Pen _textBoxOutlinePen;
-        private Pen _cursorPen;
-        private Pen _selectionBoxPen;
-        private Pen _padPressedPen;
+        private readonly Pen _textBoxOutlinePen;
+        private readonly Pen _cursorPen;
+        private readonly Pen _selectionBoxPen;
+        private readonly Pen _padPressedPen;
 
-        private int  _inputTextFontSize;
+        private readonly int _inputTextFontSize;
         private Font _messageFont;
         private Font _inputTextFont;
         private Font _labelsTextFont;
 
         private RectangleF _panelRectangle;
-        private Point      _logoPosition;
-        private float      _messagePositionY;
+        private Point _logoPosition;
+        private float _messagePositionY;
 
         public SoftwareKeyboardRendererBase(IHostUiTheme uiTheme)
         {
@@ -72,35 +72,35 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
             string padAcceptIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnA.png";
             string padCancelIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnB.png";
-            string keyModeIconPath   = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_KeyF6.png";
+            string keyModeIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_KeyF6.png";
 
-            _padAcceptIcon = LoadResource(Assembly.GetExecutingAssembly(), padAcceptIconPath  , 0, 0);
-            _padCancelIcon = LoadResource(Assembly.GetExecutingAssembly(), padCancelIconPath  , 0, 0);
-            _keyModeIcon   = LoadResource(Assembly.GetExecutingAssembly(), keyModeIconPath    , 0, 0);
+            _padAcceptIcon = LoadResource(Assembly.GetExecutingAssembly(), padAcceptIconPath, 0, 0);
+            _padCancelIcon = LoadResource(Assembly.GetExecutingAssembly(), padCancelIconPath, 0, 0);
+            _keyModeIcon = LoadResource(Assembly.GetExecutingAssembly(), keyModeIconPath, 0, 0);
 
-            Color panelColor               = ToColor(uiTheme.DefaultBackgroundColor, 255);
-            Color panelTransparentColor    = ToColor(uiTheme.DefaultBackgroundColor, 150);
-            Color borderColor              = ToColor(uiTheme.DefaultBorderColor);
+            Color panelColor = ToColor(uiTheme.DefaultBackgroundColor, 255);
+            Color panelTransparentColor = ToColor(uiTheme.DefaultBackgroundColor, 150);
+            Color borderColor = ToColor(uiTheme.DefaultBorderColor);
             Color selectionBackgroundColor = ToColor(uiTheme.SelectionBackgroundColor);
 
-            _textNormalColor     = ToColor(uiTheme.DefaultForegroundColor);
-            _textSelectedColor   = ToColor(uiTheme.SelectionForegroundColor);
+            _textNormalColor = ToColor(uiTheme.DefaultForegroundColor);
+            _textSelectedColor = ToColor(uiTheme.SelectionForegroundColor);
             _textOverCursorColor = ToColor(uiTheme.DefaultForegroundColor, null, true);
 
             float cursorWidth = 2;
 
             _textBoxOutlineWidth = 2;
-            _padPressedPenWidth  = 2;
+            _padPressedPenWidth = 2;
 
-            _panelBrush        = new SolidBrush(panelColor);
-            _disabledBrush     = new SolidBrush(panelTransparentColor);
-            _cursorBrush       = new SolidBrush(_textNormalColor);
+            _panelBrush = new SolidBrush(panelColor);
+            _disabledBrush = new SolidBrush(panelTransparentColor);
+            _cursorBrush = new SolidBrush(_textNormalColor);
             _selectionBoxBrush = new SolidBrush(selectionBackgroundColor);
 
             _textBoxOutlinePen = new Pen(borderColor, _textBoxOutlineWidth);
-            _cursorPen         = new Pen(_textNormalColor, cursorWidth);
-            _selectionBoxPen   = new Pen(selectionBackgroundColor, cursorWidth);
-            _padPressedPen     = new Pen(borderColor, _padPressedPenWidth);
+            _cursorPen = new Pen(_textNormalColor, cursorWidth);
+            _selectionBoxPen = new Pen(selectionBackgroundColor, cursorWidth);
+            _padPressedPen = new Pen(borderColor, _padPressedPenWidth);
 
             _inputTextFontSize = 20;
 
@@ -111,22 +111,21 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
         {
             // Try a list of fonts in case any of them is not available in the system.
 
-            string[] availableFonts = new string[]
-            {
+            string[] availableFonts = {
                 uiThemeFontFamily,
                 "Liberation Sans",
                 "FreeSans",
                 "DejaVu Sans",
-                "Lucida Grande"
+                "Lucida Grande",
             };
 
             foreach (string fontFamily in availableFonts)
             {
                 try
                 {
-                    _messageFont    = SystemFonts.CreateFont(fontFamily, 26,                 FontStyle.Regular);
-                    _inputTextFont  = SystemFonts.CreateFont(fontFamily, _inputTextFontSize, FontStyle.Regular);
-                    _labelsTextFont = SystemFonts.CreateFont(fontFamily, 24,                 FontStyle.Regular);
+                    _messageFont = SystemFonts.CreateFont(fontFamily, 26, FontStyle.Regular);
+                    _inputTextFont = SystemFonts.CreateFont(fontFamily, _inputTextFontSize, FontStyle.Regular);
+                    _labelsTextFont = SystemFonts.CreateFont(fontFamily, 24, FontStyle.Regular);
 
                     return;
                 }
@@ -138,7 +137,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
             throw new Exception($"None of these fonts were found in the system: {String.Join(", ", availableFonts)}!");
         }
 
-        private Color ToColor(ThemeColor color, byte? overrideAlpha = null, bool flipRgb = false)
+        private static Color ToColor(ThemeColor color, byte? overrideAlpha = null, bool flipRgb = false)
         {
             var a = (byte)(color.A * 255);
             var r = (byte)(color.R * 255);
@@ -155,14 +154,14 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
             return Color.FromRgba(r, g, b, overrideAlpha.GetValueOrDefault(a));
         }
 
-        private Image LoadResource(Assembly assembly, string resourcePath, int newWidth, int newHeight)
+        private static Image LoadResource(Assembly assembly, string resourcePath, int newWidth, int newHeight)
         {
             Stream resourceStream = assembly.GetManifestResourceStream(resourcePath);
 
             return LoadResource(resourceStream, newWidth, newHeight);
         }
 
-        private Image LoadResource(Stream resourceStream, int newWidth, int newHeight)
+        private static Image LoadResource(Stream resourceStream, int newWidth, int newHeight)
         {
             Debug.Assert(resourceStream != null);
 
@@ -176,7 +175,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
             return image;
         }
 
-        private void SetGraphicsOptions(IImageProcessingContext context)
+        private static void SetGraphicsOptions(IImageProcessingContext context)
         {
             context.GetGraphicsOptions().Antialias = true;
             context.GetShapeGraphicsOptions().GraphicsOptions.Antialias = true;
@@ -198,9 +197,9 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
                 context.DrawImage(_ryujinxLogo, _logoPosition, 1);
 
                 float halfWidth = _panelRectangle.Width / 2;
-                float buttonsY  = _panelRectangle.Y + 185;
+                float buttonsY = _panelRectangle.Y + 185;
 
-                PointF disableButtonPosition = new PointF(halfWidth + 180, buttonsY);
+                PointF disableButtonPosition = new(halfWidth + 180, buttonsY);
 
                 DrawControllerToggle(context, disableButtonPosition);
             });
@@ -215,11 +214,11 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
             _surface.Mutate(context =>
             {
-                var    messageRectangle      = MeasureString(MessageText, _messageFont);
-                float  messagePositionX      = (_panelRectangle.Width - messageRectangle.Width) / 2 - messageRectangle.X;
-                float  messagePositionY      = _messagePositionY - messageRectangle.Y;
-                var    messagePosition       = new PointF(messagePositionX, messagePositionY);
-                var    messageBoundRectangle = new RectangleF(messagePositionX, messagePositionY, messageRectangle.Width, messageRectangle.Height);
+                var messageRectangle = MeasureString(MessageText, _messageFont);
+                float messagePositionX = (_panelRectangle.Width - messageRectangle.Width) / 2 - messageRectangle.X;
+                float messagePositionY = _messagePositionY - messageRectangle.Y;
+                var messagePosition = new PointF(messagePositionX, messagePositionY);
+                var messageBoundRectangle = new RectangleF(messagePositionX, messagePositionY, messageRectangle.Width, messageRectangle.Height);
 
                 SetGraphicsOptions(context);
 
@@ -238,11 +237,11 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
                 DrawTextBox(context, state);
 
                 float halfWidth = _panelRectangle.Width / 2;
-                float buttonsY  = _panelRectangle.Y + 185;
+                float buttonsY = _panelRectangle.Y + 185;
 
-                PointF acceptButtonPosition  = new PointF(halfWidth - 180, buttonsY);
-                PointF cancelButtonPosition  = new PointF(halfWidth      , buttonsY);
-                PointF disableButtonPosition = new PointF(halfWidth + 180, buttonsY);
+                PointF acceptButtonPosition = new(halfWidth - 180, buttonsY);
+                PointF cancelButtonPosition = new(halfWidth, buttonsY);
+                PointF disableButtonPosition = new(halfWidth + 180, buttonsY);
 
                 DrawPadButton(context, acceptButtonPosition, _padAcceptIcon, AcceptText, state.AcceptPressed, state.ControllerEnabled);
                 DrawPadButton(context, cancelButtonPosition, _padCancelIcon, CancelText, state.CancelPressed, state.ControllerEnabled);
@@ -262,7 +261,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
             // Use the whole area of the image to draw, even the alignment, otherwise it may shear the final
             // image if the pitch is different.
-            uint totalWidth  = _surfaceInfo.Pitch / 4;
+            uint totalWidth = _surfaceInfo.Pitch / 4;
             uint totalHeight = _surfaceInfo.Size / _surfaceInfo.Pitch;
 
             Debug.Assert(_surfaceInfo.Width <= totalWidth);
@@ -277,10 +276,10 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
         private void ComputeConstants()
         {
-            int totalWidth  = (int)_surfaceInfo.Width;
+            int totalWidth = (int)_surfaceInfo.Width;
             int totalHeight = (int)_surfaceInfo.Height;
 
-            int panelHeight    = 240;
+            int panelHeight = 240;
             int panelPositionY = totalHeight - panelHeight;
 
             _panelRectangle = new RectangleF(0, panelPositionY, totalWidth, panelHeight);
@@ -294,7 +293,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
         }
         private static RectangleF MeasureString(string text, Font font)
         {
-            RendererOptions options = new RendererOptions(font);
+            RendererOptions options = new(font);
 
             if (text == "")
             {
@@ -310,7 +309,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
         private static RectangleF MeasureString(ReadOnlySpan<char> text, Font font)
         {
-            RendererOptions options = new RendererOptions(font);
+            RendererOptions options = new(font);
 
             if (text == "")
             {
@@ -327,14 +326,14 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
         {
             var inputTextRectangle = MeasureString(state.InputText, _inputTextFont);
 
-            float boxWidth  = (int)(Math.Max(300, inputTextRectangle.Width + inputTextRectangle.X + 8));
+            float boxWidth = (int)(Math.Max(300, inputTextRectangle.Width + inputTextRectangle.X + 8));
             float boxHeight = 32;
-            float boxY      = _panelRectangle.Y + 110;
-            float boxX      = (int)((_panelRectangle.Width - boxWidth) / 2);
+            float boxY = _panelRectangle.Y + 110;
+            float boxX = (int)((_panelRectangle.Width - boxWidth) / 2);
 
-            RectangleF boxRectangle = new RectangleF(boxX, boxY, boxWidth, boxHeight);
+            RectangleF boxRectangle = new(boxX, boxY, boxWidth, boxHeight);
 
-            RectangleF boundRectangle = new RectangleF(_panelRectangle.X, boxY - _textBoxOutlineWidth,
+            RectangleF boundRectangle = new(_panelRectangle.X, boxY - _textBoxOutlineWidth,
                     _panelRectangle.Width, boxHeight + 2 * _textBoxOutlineWidth);
 
             context.Fill(_panelBrush, boundRectangle);
@@ -350,11 +349,11 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
             // Draw the cursor on top of the text and redraw the text with a different color if necessary.
 
-            Color  cursorTextColor;
+            Color cursorTextColor;
             IBrush cursorBrush;
-            Pen    cursorPen;
+            Pen cursorPen;
 
-            float cursorPositionYTop    = inputTextY + 1;
+            float cursorPositionYTop = inputTextY + 1;
             float cursorPositionYBottom = cursorPositionYTop + _inputTextFontSize + 1;
             float cursorPositionXLeft;
             float cursorPositionXRight;
@@ -366,34 +365,34 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
                 Debug.Assert(state.InputText.Length > 0);
 
                 cursorTextColor = _textSelectedColor;
-                cursorBrush     = _selectionBoxBrush;
-                cursorPen       = _selectionBoxPen;
+                cursorBrush = _selectionBoxBrush;
+                cursorPen = _selectionBoxPen;
 
                 ReadOnlySpan<char> textUntilBegin = state.InputText.AsSpan(0, state.CursorBegin);
-                ReadOnlySpan<char> textUntilEnd   = state.InputText.AsSpan(0, state.CursorEnd);
+                ReadOnlySpan<char> textUntilEnd = state.InputText.AsSpan(0, state.CursorEnd);
 
                 var selectionBeginRectangle = MeasureString(textUntilBegin, _inputTextFont);
-                var selectionEndRectangle   = MeasureString(textUntilEnd  , _inputTextFont);
+                var selectionEndRectangle = MeasureString(textUntilEnd, _inputTextFont);
 
-                cursorVisible         = true;
-                cursorPositionXLeft   = inputTextX + selectionBeginRectangle.Width + selectionBeginRectangle.X;
-                cursorPositionXRight  = inputTextX + selectionEndRectangle.Width   + selectionEndRectangle.X;
+                cursorVisible = true;
+                cursorPositionXLeft = inputTextX + selectionBeginRectangle.Width + selectionBeginRectangle.X;
+                cursorPositionXRight = inputTextX + selectionEndRectangle.Width + selectionEndRectangle.X;
             }
             else
             {
                 cursorTextColor = _textOverCursorColor;
-                cursorBrush     = _cursorBrush;
-                cursorPen       = _cursorPen;
+                cursorBrush = _cursorBrush;
+                cursorPen = _cursorPen;
 
                 if (state.TextBoxBlinkCounter < TextBoxBlinkThreshold)
                 {
                     // Show the blinking cursor.
 
-                    int                cursorBegin         = Math.Min(state.InputText.Length, state.CursorBegin);
-                    ReadOnlySpan<char> textUntilCursor     = state.InputText.AsSpan(0, cursorBegin);
-                    var                cursorTextRectangle = MeasureString(textUntilCursor, _inputTextFont);
+                    int cursorBegin = Math.Min(state.InputText.Length, state.CursorBegin);
+                    ReadOnlySpan<char> textUntilCursor = state.InputText.AsSpan(0, cursorBegin);
+                    var cursorTextRectangle = MeasureString(textUntilCursor, _inputTextFont);
 
-                    cursorVisible       = true;
+                    cursorVisible = true;
                     cursorPositionXLeft = inputTextX + cursorTextRectangle.Width + cursorTextRectangle.X;
 
                     if (state.OverwriteMode)
@@ -402,8 +401,8 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
                         if (state.CursorBegin < state.InputText.Length)
                         {
-                            textUntilCursor      = state.InputText.AsSpan(0, cursorBegin + 1);
-                            cursorTextRectangle  = MeasureString(textUntilCursor, _inputTextFont);
+                            textUntilCursor = state.InputText.AsSpan(0, cursorBegin + 1);
+                            cursorTextRectangle = MeasureString(textUntilCursor, _inputTextFont);
                             cursorPositionXRight = inputTextX + cursorTextRectangle.Width + cursorTextRectangle.X;
                         }
                         else
@@ -419,20 +418,19 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
                 }
                 else
                 {
-                    cursorPositionXLeft  = inputTextX;
+                    cursorPositionXLeft = inputTextX;
                     cursorPositionXRight = inputTextX;
                 }
             }
 
             if (state.TypingEnabled && cursorVisible)
             {
-                float cursorWidth  = cursorPositionXRight  - cursorPositionXLeft;
+                float cursorWidth = cursorPositionXRight - cursorPositionXLeft;
                 float cursorHeight = cursorPositionYBottom - cursorPositionYTop;
 
                 if (cursorWidth == 0)
                 {
-                    PointF[] points = new PointF[]
-                    {
+                    PointF[] points = {
                         new PointF(cursorPositionXLeft, cursorPositionYTop),
                         new PointF(cursorPositionXLeft, cursorPositionYBottom),
                     };
@@ -443,10 +441,10 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
                 {
                     var cursorRectangle = new RectangleF(cursorPositionXLeft, cursorPositionYTop, cursorWidth, cursorHeight);
 
-                    context.Draw(cursorPen  , cursorRectangle);
+                    context.Draw(cursorPen, cursorRectangle);
                     context.Fill(cursorBrush, cursorRectangle);
 
-                    Image<Argb32> textOverCursor = new Image<Argb32>((int)cursorRectangle.Width, (int)cursorRectangle.Height);
+                    Image<Argb32> textOverCursor = new((int)cursorRectangle.Width, (int)cursorRectangle.Height);
                     textOverCursor.Mutate(context =>
                     {
                         var textRelativePosition = new PointF(inputTextPosition.X - cursorRectangle.X, inputTextPosition.Y - cursorRectangle.Y);
@@ -470,9 +468,9 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
         {
             // Use relative positions so we can center the the entire drawing later.
 
-            float iconX      = 0;
-            float iconY      = 0;
-            float iconWidth  = icon.Width;
+            float iconX = 0;
+            float iconY = 0;
+            float iconWidth = icon.Width;
             float iconHeight = icon.Height;
 
             var labelRectangle = MeasureString(label, _labelsTextFont);
@@ -480,18 +478,18 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
             float labelPositionX = iconWidth + 8 - labelRectangle.X;
             float labelPositionY = 3;
 
-            float fullWidth  = labelPositionX + labelRectangle.Width + labelRectangle.X;
+            float fullWidth = labelPositionX + labelRectangle.Width + labelRectangle.X;
             float fullHeight = iconHeight;
 
             // Convert all relative positions into absolute.
 
-            float originX = (int)(point.X - fullWidth  / 2);
+            float originX = (int)(point.X - fullWidth / 2);
             float originY = (int)(point.Y - fullHeight / 2);
 
             iconX += originX;
             iconY += originY;
 
-            var iconPosition  = new Point((int)iconX, (int)iconY);
+            var iconPosition = new Point((int)iconX, (int)iconY);
             var labelPosition = new PointF(labelPositionX + originX, labelPositionY + originY);
 
             var selectedRectangle = new RectangleF(originX - 2 * _padPressedPenWidth, originY - 2 * _padPressedPenWidth,
@@ -526,7 +524,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
             // Use relative positions so we can center the the entire drawing later.
 
-            float keyWidth  = _keyModeIcon.Width;
+            float keyWidth = _keyModeIcon.Width;
             float keyHeight = _keyModeIcon.Height;
 
             float labelPositionX = keyWidth + 8 - labelRectangle.X;
@@ -535,18 +533,18 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
             float keyX = 0;
             float keyY = (int)((labelPositionY + labelRectangle.Height - keyHeight) / 2);
 
-            float fullWidth  = labelPositionX + labelRectangle.Width;
+            float fullWidth = labelPositionX + labelRectangle.Width;
             float fullHeight = Math.Max(labelPositionY + labelRectangle.Height, keyHeight);
 
             // Convert all relative positions into absolute.
 
-            float originX = (int)(point.X - fullWidth  / 2);
+            float originX = (int)(point.X - fullWidth / 2);
             float originY = (int)(point.Y - fullHeight / 2);
 
             keyX += originX;
             keyY += originY;
 
-            var labelPosition   = new PointF(labelPositionX + originX, labelPositionY + originY);
+            var labelPosition = new PointF(labelPositionX + originX, labelPositionY + originY);
             var overlayPosition = new Point((int)keyX, (int)keyY);
 
             context.DrawImage(_keyModeIcon, overlayPosition, 1);
-- 
cgit v1.2.3-70-g09d2