mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
UI - Decreased device visualizer CPU usage
Keyframes - Snap to closest 50 ms while Ctrl is held down
This commit is contained in:
1 parent
651fc515d2
commit
5e345fed7c
8 files changed
+73
-62
No files matched your search
@@ -330,14 +330,15 @@ namespace Artemis.UI.Shared
|
||||
|
||||
private void Render()
|
||||
{
|
||||
DrawingContext drawingContext = _backingStore.Open();
|
||||
DrawingContext drawingContext = _backingStore.Append();
|
||||
// DrawingContext drawingContext = _backingStore.Open();
|
||||
|
||||
if (HighlightedLeds != null && HighlightedLeds.Any())
|
||||
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)
|
||||
deviceVisualizerLed.RenderColor(drawingContext, !HighlightedLeds.Contains(deviceVisualizerLed.Led));
|
||||
deviceVisualizerLed.RenderColor(_backingStore, drawingContext, !HighlightedLeds.Contains(deviceVisualizerLed.Led));
|
||||
else
|
||||
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)
|
||||
deviceVisualizerLed.RenderColor(drawingContext, false);
|
||||
deviceVisualizerLed.RenderColor(_backingStore, drawingContext, false);
|
||||
|
||||
drawingContext.Close();
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@ namespace Artemis.UI.Shared
|
||||
{
|
||||
private const byte Dimmed = 100;
|
||||
private const byte NonDimmed = 255;
|
||||
private GeometryDrawing? _geometryDrawing;
|
||||
private Color _renderColor;
|
||||
|
||||
private SolidColorBrush? _renderColorBrush;
|
||||
private Color _renderColor;
|
||||
|
||||
public DeviceVisualizerLed(ArtemisLed led)
|
||||
{
|
||||
@@ -40,12 +41,13 @@ namespace Artemis.UI.Shared
|
||||
public BitmapImage? LedImage { get; set; }
|
||||
public Geometry? DisplayGeometry { get; private set; }
|
||||
|
||||
public void RenderColor(DrawingContext drawingContext, bool isDimmed)
|
||||
public void RenderColor(DrawingGroup backingStore, DrawingContext drawingContext, bool isDimmed)
|
||||
{
|
||||
if (DisplayGeometry == null)
|
||||
return;
|
||||
|
||||
_renderColorBrush ??= new SolidColorBrush();
|
||||
_geometryDrawing ??= new GeometryDrawing(_renderColorBrush, null, new RectangleGeometry(LedRect));
|
||||
|
||||
byte r = Led.RgbLed.Color.GetR();
|
||||
byte g = Led.RgbLed.Color.GetG();
|
||||
@@ -56,7 +58,10 @@ namespace Artemis.UI.Shared
|
||||
_renderColor.G = g;
|
||||
_renderColor.B = b;
|
||||
_renderColorBrush.Color = _renderColor;
|
||||
drawingContext.DrawRectangle(_renderColorBrush, null, LedRect);
|
||||
|
||||
|
||||
if (!backingStore.Children.Contains(_geometryDrawing))
|
||||
backingStore.Children.Add(_geometryDrawing);
|
||||
}
|
||||
|
||||
public void RenderImage(DrawingContext drawingContext)
|
||||
|
||||
Reference in new issue
Block a user