Skip to content

Commit

Permalink
fix(grid): Fix a bug with new Grid implementation on Skia where the "…
Browse files Browse the repository at this point in the history
…Pixel" mode were not properly applied when the UseLayoutRounding were true.
  • Loading branch information
carldebilly committed Apr 26, 2021
1 parent 18aa879 commit db07a62
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/Grid/Grid.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Text;
using Uno.UI;
using Uno.UI.Extensions;
using Uno.UI.Xaml;

#if XAMARIN_ANDROID
Expand Down Expand Up @@ -105,6 +106,8 @@ public double ColumnSpacing

private static void OnGenericPropertyChanged(object dependencyObject, DependencyPropertyChangedEventArgs args)
{

(dependencyObject as View)?.InvalidateMeasure();
(dependencyObject as View)?.InvalidateArrange();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Uno.UI/UI/Xaml/Controls/Grid/Grid.h.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ void InvalidateDefinitions()
m_gridFlags =
GridFlags.None; // Internal grid flags used for layout processing. Should have enough bits to fit all flags set by SetGridFlag.

private double XcpAbsF(double rValue) => rValue < 0.0 ? -rValue : rValue;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private double XcpAbsF(double rValue) => Math.Abs(rValue);

private UIElementCollection GetUnsortedChildren() => Children;
}
Expand Down
6 changes: 4 additions & 2 deletions src/Uno.UI/UI/Xaml/UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,10 @@ internal double GetScaleFactorForLayoutRounding()
return global::Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi / 96.0f; // 100%
}

int XcpRound(double x)
=> (int)Math.Floor(x + 0.5);
double XcpRound(double x)
{
return Math.Round(x);
}

#if HAS_UNO_WINUI
#region FocusState DependencyProperty
Expand Down

0 comments on commit db07a62

Please sign in to comment.