mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
make wootingcolor readonly, use int for array index
This commit is contained in:
parent
a96b994e61
commit
34b04523de
@ -66,7 +66,7 @@ public sealed class WootingGrpcDeviceProvider : AbstractRGBDeviceProvider
|
|||||||
_client = new RgbSdkService.RgbSdkServiceClient(_channel);
|
_client = new RgbSdkService.RgbSdkServiceClient(_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(_client, nameof(_client));
|
ArgumentNullException.ThrowIfNull(_client, nameof(_client));
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public sealed class WootingGrpcUpdateQueue : UpdateQueue
|
|||||||
foreach ((object key, Color color) in dataSet)
|
foreach ((object key, Color color) in dataSet)
|
||||||
{
|
{
|
||||||
(int row, int column) = ((int, int))key;
|
(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());
|
_colors[index] = new WootingColor(color.GetR(), color.GetG(), color.GetB());
|
||||||
}
|
}
|
||||||
@ -79,12 +79,12 @@ public sealed class WootingGrpcUpdateQueue : UpdateQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
internal struct WootingColor
|
internal readonly struct WootingColor
|
||||||
{
|
{
|
||||||
public byte r;
|
public readonly byte r;
|
||||||
public byte g;
|
public readonly byte g;
|
||||||
public byte b;
|
public readonly byte b;
|
||||||
public byte a;
|
public readonly byte a;
|
||||||
|
|
||||||
public WootingColor(byte r, byte g, byte b)
|
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
|
this.a = 0; // Alpha is not used in Wooting devices
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user