1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Profiles - Fixed a render issue when changing LED selection

Plugins - Improved error wording when loading a plugin with duplicate GUID
This commit is contained in:
SpoinkyNL 2021-02-05 20:50:28 +01:00
parent 6c90943944
commit 4f7e35d167
2 changed files with 10 additions and 3 deletions

View File

@ -7,6 +7,8 @@ namespace Artemis.Core
{ {
private bool _valid; private bool _valid;
private bool _disposed; private bool _disposed;
private SKRect _lastBounds;
private SKRect _lastParentBounds;
public SKBitmap? Bitmap { get; private set; } public SKBitmap? Bitmap { get; private set; }
public SKCanvas? Canvas { get; private set; } public SKCanvas? Canvas { get; private set; }
public SKPaint? Paint { get; private set; } public SKPaint? Paint { get; private set; }
@ -26,6 +28,9 @@ namespace Artemis.Core
if (IsOpen) if (IsOpen)
throw new ArtemisCoreException("Cannot open render context because it is already open"); throw new ArtemisCoreException("Cannot open render context because it is already open");
if (path.Bounds != _lastBounds || (parent != null && parent.Bounds != _lastParentBounds))
Invalidate();
if (!_valid || Canvas == null) if (!_valid || Canvas == null)
{ {
SKRect pathBounds = path.Bounds; SKRect pathBounds = path.Bounds;
@ -43,6 +48,8 @@ namespace Artemis.Core
Canvas.ClipPath(Path); Canvas.ClipPath(Path);
_lastParentBounds = parent?.Bounds ?? new SKRect();
_lastBounds = path.Bounds;
_valid = true; _valid = true;
} }
@ -58,7 +65,7 @@ namespace Artemis.Core
{ {
if (_disposed) if (_disposed)
throw new ObjectDisposedException("Renderer"); throw new ObjectDisposedException("Renderer");
Canvas?.Restore(); Canvas?.Restore();
Paint?.Dispose(); Paint?.Dispose();
Paint = null; Paint = null;

View File

@ -253,13 +253,13 @@ namespace Artemis.Core.Services
PluginInfo pluginInfo = CoreJson.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile))!; PluginInfo pluginInfo = CoreJson.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile))!;
if (pluginInfo.Guid == Constants.CorePluginInfo.Guid) if (pluginInfo.Guid == Constants.CorePluginInfo.Guid)
throw new ArtemisPluginException($"Plugin cannot use reserved GUID {pluginInfo.Guid}"); throw new ArtemisPluginException($"Plugin {pluginInfo} cannot use reserved GUID {pluginInfo.Guid}");
lock (_plugins) lock (_plugins)
{ {
// Ensure the plugin is not already loaded // Ensure the plugin is not already loaded
if (_plugins.Any(p => p.Guid == pluginInfo.Guid)) if (_plugins.Any(p => p.Guid == pluginInfo.Guid))
throw new ArtemisCoreException("Cannot load a plugin that is already loaded"); throw new ArtemisCoreException($"Cannot load plugin {pluginInfo} because it is using a GUID already used by another plugin");
} }
// Load the entity and fall back on creating a new one // Load the entity and fall back on creating a new one