make wootingcolor readonly, use int for array index

This commit is contained in:
Diogo Trindade committed 2025-06-18 19:31:00 +01:00
1 parent a96b994e61
commit 34b04523de
1 file changed
+6 -7
@@ -48,7 +48,7 @@ public sealed class WootingGrpcUpdateQueue : UpdateQueue
foreach ((object key, Color color) in dataSet)
{
(int row, int column) = ((int, int))key;
long index = (WootingLedMappings.COLUMNS * row) + column;
int index = (WootingLedMappings.COLUMNS * row) + column;
_colors[index] = new WootingColor(color.GetR(), color.GetG(), color.GetB());
}
@@ -79,12 +79,12 @@ public sealed class WootingGrpcUpdateQueue : UpdateQueue
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct WootingColor
internal readonly struct WootingColor
{
public byte r;
public byte g;
public byte b;
public byte a;
public readonly byte r;
public readonly byte g;
public readonly byte b;
public readonly byte a;
public WootingColor(byte r, byte g, byte b)
{
@@ -94,4 +94,3 @@ internal struct WootingColor
this.a = 0; // Alpha is not used in Wooting devices
}
}