|
|
|
@ -590,7 +590,7 @@ namespace Avalonia.Layout |
|
|
|
|
|
|
|
if (UseLayoutRounding) |
|
|
|
{ |
|
|
|
var scale = GetLayoutScale(); |
|
|
|
var scale = LayoutHelper.GetLayoutScale(this); |
|
|
|
width = LayoutHelper.RoundLayoutValue(width, scale); |
|
|
|
height = LayoutHelper.RoundLayoutValue(height, scale); |
|
|
|
} |
|
|
|
@ -652,7 +652,7 @@ namespace Avalonia.Layout |
|
|
|
var horizontalAlignment = HorizontalAlignment; |
|
|
|
var verticalAlignment = VerticalAlignment; |
|
|
|
var size = availableSizeMinusMargins; |
|
|
|
var scale = GetLayoutScale(); |
|
|
|
var scale = LayoutHelper.GetLayoutScale(this); |
|
|
|
var useLayoutRounding = UseLayoutRounding; |
|
|
|
|
|
|
|
if (horizontalAlignment != HorizontalAlignment.Stretch) |
|
|
|
@ -833,17 +833,5 @@ namespace Avalonia.Layout |
|
|
|
{ |
|
|
|
return new Size(Math.Max(size.Width, 0), Math.Max(size.Height, 0)); |
|
|
|
} |
|
|
|
|
|
|
|
private double GetLayoutScale() |
|
|
|
{ |
|
|
|
var result = (VisualRoot as ILayoutRoot)?.LayoutScaling ?? 1.0; |
|
|
|
|
|
|
|
if (result == 0 || double.IsNaN(result) || double.IsInfinity(result)) |
|
|
|
{ |
|
|
|
throw new Exception($"Invalid LayoutScaling returned from {VisualRoot.GetType()}"); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|