mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Further RGB.NET updates
This commit is contained in:
parent
5bcba8a4a5
commit
4b914718e6
@ -49,7 +49,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
LedGroup.ZIndex = 1;
|
||||
|
||||
List<Led> missingLeds = Layer.Leds.Where(l => !LedGroup.ContainsLed(l.RgbLed)).Select(l => l.RgbLed).ToList();
|
||||
List<Led> extraLeds = LedGroup.GetLeds().Where(l => Layer.Leds.All(layerLed => layerLed.RgbLed != l)).ToList();
|
||||
List<Led> extraLeds = LedGroup.Where(l => Layer.Leds.All(layerLed => layerLed.RgbLed != l)).ToList();
|
||||
LedGroup.AddLeds(missingLeds);
|
||||
LedGroup.RemoveLeds(extraLeds);
|
||||
LedGroup.Brush = GetBrush();
|
||||
@ -78,7 +78,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
throw new ArtemisCoreException("Cannot dispose RGB.NET layer brush because RgbService is not set");
|
||||
|
||||
Layer.RenderPropertiesUpdated -= LayerOnRenderPropertiesUpdated;
|
||||
LedGroup?.Detach(RgbService.Surface);
|
||||
LedGroup?.Detach();
|
||||
LedGroup = null;
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Represents a SkiaSharp-based RGB.NET PixelTexture
|
||||
/// </summary>
|
||||
public sealed class SKTexture : PixelTexture<byte>
|
||||
public sealed class SKTexture : PixelTexture<byte>, IDisposable
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@ -42,6 +42,12 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
protected override ReadOnlySpan<byte> Data => Bitmap.GetPixelSpan();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
Bitmap.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -258,10 +258,8 @@ namespace Artemis.Core.Services
|
||||
|
||||
private void InvalidateBitmap()
|
||||
{
|
||||
|
||||
lock (_bitmapLock)
|
||||
{
|
||||
_bitmap?.Dispose();
|
||||
_bitmap = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ namespace Artemis.Core.Services
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(200);
|
||||
ledGroup.Detach(_rgbService.Surface);
|
||||
ledGroup.Detach();
|
||||
|
||||
if (blinkCount < 5)
|
||||
{
|
||||
|
||||
@ -136,8 +136,11 @@ namespace Artemis.Core.Services
|
||||
|
||||
public void UpdateTexture(SKBitmap bitmap)
|
||||
{
|
||||
SKTexture? oldTexture = Texture;
|
||||
Texture = new SKTexture(bitmap);
|
||||
TextureBrush.Texture = Texture;
|
||||
|
||||
oldTexture?.Dispose();
|
||||
}
|
||||
|
||||
private void SurfaceOnLayoutChanged(SurfaceLayoutChangedEventArgs args) => UpdateLedGroup();
|
||||
@ -161,7 +164,7 @@ namespace Artemis.Core.Services
|
||||
lock (_surfaceLedGroup)
|
||||
{
|
||||
// Clean up the old background
|
||||
_surfaceLedGroup.Detach(Surface);
|
||||
_surfaceLedGroup.Detach();
|
||||
|
||||
// Apply the application wide brush and decorator
|
||||
_surfaceLedGroup = new ListLedGroup(Surface, LedMap.Select(l => l.Key)) { Brush = TextureBrush };
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
||||
{
|
||||
base.OnDialogClosed(sender, e);
|
||||
_inputService.DeviceIdentified -= InputServiceOnDeviceIdentified;
|
||||
_ledGroup.Detach(_rgbService.Surface);
|
||||
_ledGroup.Detach();
|
||||
}
|
||||
|
||||
private void InputServiceOnDeviceIdentified(object sender, EventArgs e)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user