Fixed LED UI rendering perf

This commit is contained in:
SpoinkyNL committed 2019-08-19 23:10:28 +02:00
1 parent b3e035cfb3
commit dcf206dbaf
2 files changed
+33 -8

No files matched your search

@@ -28,6 +28,7 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
public double Height { get; private set; }
public Geometry DisplayGeometry { get; private set; }
public Geometry StrokeGeometry { get; private set; }
public Color DisplayColor { get; private set; }
public string Tooltip => $"{Led.Id} - {Led.LedRectangle}";
@@ -66,6 +67,28 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
GeometryCombineMode.Union,
new ScaleTransform(Led.LedRectangle.Width, Led.LedRectangle.Height)
);
// Create a smaller version of the display geometry
var innerGeometry = Geometry.Combine(
Geometry.Empty,
geometry,
GeometryCombineMode.Union,
new TransformGroup
{
Children = new TransformCollection
{
new ScaleTransform(Led.LedRectangle.Width - 2, Led.LedRectangle.Height - 2),
new TranslateTransform(1, 1)
}
}
);
// Stroke geometry is the display geometry excluding the inner geometry
StrokeGeometry = Geometry.Combine(
DisplayGeometry,
innerGeometry,
GeometryCombineMode.Exclude,
null
);
}
public void Update()