Changed Point and Size to be an immutable value-types

This commit is contained in:
DarthAffe committed 2017-12-05 14:25:38 +01:00
1 parent 302ff7743f
commit 1865b4d83e
14 files changed
+209 -260

No files matched your search

@@ -54,10 +54,10 @@ namespace RGB.NET.Devices.Novation
{
InitializeLayout();
if (InternalSize == null)
if (Size == Size.Invalid)
{
Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle));
InternalSize = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
}
}
@@ -79,7 +79,7 @@ namespace RGB.NET.Devices.Novation
{
LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase));
InternalSize = new Size(layout.Width, layout.Height);
Size = new Size(layout.Width, layout.Height);
if (layout.Leds != null)
foreach (LedLayout layoutLed in layout.Leds)
@@ -88,10 +88,8 @@ namespace RGB.NET.Devices.Novation
{
if (LedMapping.TryGetValue(new NovationLedId(this, ledId), out Led led))
{
led.LedRectangle.Location.X = layoutLed.X;
led.LedRectangle.Location.Y = layoutLed.Y;
led.LedRectangle.Size.Width = layoutLed.Width;
led.LedRectangle.Size.Height = layoutLed.Height;
led.LedRectangle.Location = new Point(layoutLed.X, layoutLed.Y);
led.LedRectangle.Size = new Size(layoutLed.Width, layoutLed.Height);
led.Shape = layoutLed.Shape;
led.ShapeData = layoutLed.ShapeData;