diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs index 4b096a9d1..40f2c42bd 100644 --- a/src/Artemis.Core/Services/RgbService.cs +++ b/src/Artemis.Core/Services/RgbService.cs @@ -36,7 +36,7 @@ namespace Artemis.Core.Services _pluginManagementService = pluginManagementService; _deviceRepository = deviceRepository; _targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 25); - _renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.5); + _renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.25); Surface = new RGBSurface(); Utilities.RenderScaleMultiplier = (int) (1 / _renderScaleSetting.Value); diff --git a/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs index 895d903a0..7eb659f62 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs @@ -216,11 +216,11 @@ namespace Artemis.UI.Screens.Settings.Tabs.General public double RenderScale { - get => _settingsService.GetSetting("Core.RenderScale", 0.5).Value; + get => _settingsService.GetSetting("Core.RenderScale", 0.25).Value; set { - _settingsService.GetSetting("Core.RenderScale", 0.5).Value = value; - _settingsService.GetSetting("Core.RenderScale", 0.5).Save(); + _settingsService.GetSetting("Core.RenderScale", 0.25).Value = value; + _settingsService.GetSetting("Core.RenderScale", 0.25).Save(); } } diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs index 0d581ddb6..d772643be 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs @@ -108,7 +108,7 @@ namespace Artemis.UI.Screens.SurfaceEditor set => SetAndNotify(ref _colorFirstLedOnly, value); } - public double MaxTextureSize => 4096 / _settingsService.GetSetting("Core.RenderScale", 0.5).Value; + public double MaxTextureSize => 4096 / _settingsService.GetSetting("Core.RenderScale", 0.25).Value; public double MaxTextureSizeIndicatorThickness => 2 / PanZoomViewModel.Zoom; public void OpenHyperlink(object sender, RequestNavigateEventArgs e) diff --git a/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceViewModel.cs index 82d14326c..3a2e755e9 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceViewModel.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceViewModel.cs @@ -103,7 +103,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Visualization if (x < 0 || y < 0) return false; - double maxTextureSize = 4096 / _settingsService.GetSetting("Core.RenderScale", 0.5).Value; + double maxTextureSize = 4096 / _settingsService.GetSetting("Core.RenderScale", 0.25).Value; if (x + Device.Rectangle.Width > maxTextureSize || y + Device.Rectangle.Height > maxTextureSize) return false; diff --git a/src/Artemis.UI/Services/LayerEditorService.cs b/src/Artemis.UI/Services/LayerEditorService.cs index 4ecde9cd8..7c5a8ec47 100644 --- a/src/Artemis.UI/Services/LayerEditorService.cs +++ b/src/Artemis.UI/Services/LayerEditorService.cs @@ -1,9 +1,12 @@ using System; +using System.Linq; using System.Windows; using System.Windows.Media; using Artemis.Core; +using RGB.NET.Core; using SkiaSharp; using SkiaSharp.Views.WPF; +using Point = System.Windows.Point; namespace Artemis.UI.Services { @@ -12,12 +15,15 @@ namespace Artemis.UI.Services /// public Rect GetLayerBounds(Layer layer) { - // Adjust the render rectangle for the difference in render scale - return new( - layer.Bounds.Left, - layer.Bounds.Top, - Math.Max(0, layer.Bounds.Width), - Math.Max(0, layer.Bounds.Height) + return new Rect( + new Point( + layer.Leds.Min(l => l.RgbLed.AbsoluteBoundary.Location.X), + layer.Leds.Min(l => l.RgbLed.AbsoluteBoundary.Location.Y + )), + new Point( + layer.Leds.Max(l => l.RgbLed.AbsoluteBoundary.Location.X + l.RgbLed.AbsoluteBoundary.Size.Width), + layer.Leds.Max(l => l.RgbLed.AbsoluteBoundary.Location.Y + l.RgbLed.AbsoluteBoundary.Size.Height + )) ); } @@ -94,15 +100,16 @@ namespace Artemis.UI.Services /// public SKPoint GetScaledPoint(Layer layer, SKPoint point, bool absolute) { + SKRect bounds = GetLayerBounds(layer).ToSKRect(); if (absolute) return new SKPoint( - 100f / layer.Bounds.Width * (point.X - layer.Bounds.Left) / 100f, - 100f / layer.Bounds.Height * (point.Y - layer.Bounds.Top) / 100f + 100 / bounds.Width * (point.X - bounds.Left) / 100, + 100 / bounds.Height * (point.Y - bounds.Top) / 100 ); return new SKPoint( - 100f / layer.Bounds.Width * point.X / 100f, - 100f / layer.Bounds.Height * point.Y / 100f + 100 / bounds.Width * point.X / 100, + 100 / bounds.Height * point.Y / 100 ); }