[Ryujinx.Graphics.Texture] Address dotnet-format issues (#5375)

* dotnet format style --severity info

Some changes were manually reverted.

* Restore a few unused methods and variables

* Silence dotnet format IDE0060 warnings

* Silence dotnet format IDE0059 warnings

* Address or silence dotnet format CA2208 warnings

* 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

* Format if-blocks correctly

* Add comments to disabled warnings

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

* Address IDE0251 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

* Apply suggestions from code review

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

* Address review feedback

* Update src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs

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

---------

Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
TSRBerry 2023-06-28 18:46:18 +02:00 committed by GitHub
parent fc20d9b925
commit cebfa54467
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 741 additions and 630 deletions

View file

@ -119,12 +119,12 @@ namespace Ryujinx.Graphics.Texture.Encoders
{
uint c = tile[i];
if (!uniqueRGB.Slice(0, uniqueRGBCount).Contains(c & rgbMask))
if (!uniqueRGB[..uniqueRGBCount].Contains(c & rgbMask))
{
uniqueRGB[uniqueRGBCount++] = c & rgbMask;
}
if (!uniqueAlpha.Slice(0, uniqueAlphaCount).Contains(c & alphaMask))
if (!uniqueAlpha[..uniqueAlphaCount].Contains(c & alphaMask))
{
uniqueAlpha[uniqueAlphaCount++] = c & alphaMask;
}
@ -356,7 +356,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
bool alphaSwapSubset = alphaIndices[0] >= (alphaIndexCount >> 1);
Block block = new Block();
Block block = new();
int offset = 0;
@ -591,7 +591,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
RgbaColor32 e132 = RgbaColor8.FromUInt32(c1).GetColor32();
palette[0] = e032;
palette[palette.Length - 1] = e132;
palette[^1] = e132;
for (int i = 1; i < palette.Length - 1; i++)
{
@ -888,7 +888,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
int distRange = Math.Max(1, maxDist - minDist);
RgbaColor32 nV = new RgbaColor32(n);
RgbaColor32 nV = new(n);
int bestErrorSum = int.MaxValue;
RgbaColor8 bestE0 = default;
@ -922,8 +922,8 @@ namespace Ryujinx.Graphics.Texture.Encoders
for (int start = 0; start < numInterpolatedColors - maxIndex; start++)
{
RgbaColor32 sumY = new RgbaColor32(0);
RgbaColor32 sumXY = new RgbaColor32(0);
RgbaColor32 sumY = new(0);
RgbaColor32 sumXY = new(0);
for (int i = 0; i < indices.Length; i++)
{
@ -933,8 +933,8 @@ namespace Ryujinx.Graphics.Texture.Encoders
sumXY += new RgbaColor32(start + indices[i]) * y;
}
RgbaColor32 sumXV = new RgbaColor32(sumX);
RgbaColor32 sumXXV = new RgbaColor32(sumXX);
RgbaColor32 sumXV = new(sumX);
RgbaColor32 sumXXV = new(sumXX);
RgbaColor32 m = RgbaColor32.DivideGuarded((nV * sumXY - sumXV * sumY) << 6, nV * sumXXV - sumXV * sumXV, 0);
RgbaColor32 b = ((sumY << 6) - m * sumXV) / nV;