mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Core - Ensure devices owned by ArtemisDevice always have valid dimensions
This commit is contained in:
1 parent
76d424012a
commit
38f18613c1
3 files changed
+38
-9
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
@@ -18,6 +19,18 @@ internal static class RgbDeviceExtensions
|
||||
builder.Append(rgbDevice.DeviceInfo.DeviceType);
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public static void EnsureValidDimensions(this IRGBDevice rgbDevice)
|
||||
{
|
||||
if (rgbDevice.Location == Point.Invalid)
|
||||
rgbDevice.Location = new Point(0, 0);
|
||||
|
||||
if (rgbDevice.Size == Size.Invalid)
|
||||
{
|
||||
Rectangle ledRectangle = new(rgbDevice.Select(x => x.Boundary));
|
||||
rgbDevice.Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static class RgbRectangleExtensions
|
||||
|
||||
Reference in new issue
Block a user