diff --git a/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.skia.cs b/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.skia.cs index 10fb94fa6edf..8c4ec110fb06 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.skia.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.skia.cs @@ -47,20 +47,15 @@ partial void UpdatePlatform() if (!newState.Equals(previousLayoutState)) { - if ( - newState.Background != null || + _layerDisposable.Disposable = null; + + if (newState.Background != null || newState.CornerRadius != CornerRadius.None || - (newState.BorderThickness != Thickness.Empty && newState.BorderBrush != null) - ) + (newState.BorderThickness != Thickness.Empty && newState.BorderBrush != null)) { - _layerDisposable.Disposable = null; _layerDisposable.Disposable = InnerCreateLayer(_owner, newState); } - else - { - _layerDisposable.Disposable = null; - } _currentState = newState; } @@ -112,10 +107,9 @@ private static IDisposable InnerCreateLayer(UIElement owner, BorderLayerState st { var backgroundShape = compositor.CreateSpriteShape(); - // First we set the brush as it might alter the adjustedArea if (background is ImageBrush imgBackground) { - adjustedArea = CreateImageLayer(compositor, disposables, borderThickness, adjustedArea, backgroundShape, adjustedArea, imgBackground); + CreateImageLayer(compositor, disposables, borderThickness, adjustedArea, backgroundShape, adjustedArea, imgBackground); } else { @@ -283,7 +277,7 @@ void CreateLayer(Action builder, string name) return disposables; } - private static Rect CreateImageLayer(Compositor compositor, CompositeDisposable disposables, Thickness borderThickness, Rect adjustedArea, CompositionSpriteShape backgroundShape, Rect backgroundArea, ImageBrush imgBackground) + private static void CreateImageLayer(Compositor compositor, CompositeDisposable disposables, Thickness borderThickness, Rect adjustedArea, CompositionSpriteShape backgroundShape, Rect backgroundArea, ImageBrush imgBackground) { Action onInvalidateRender = () => { @@ -325,7 +319,6 @@ private static Rect CreateImageLayer(Compositor compositor, CompositeDisposable onInvalidateRender(); imgBackground.InvalidateRender += onInvalidateRender; new DisposableAction(() => imgBackground.InvalidateRender -= onInvalidateRender).DisposeWith(disposables); - return backgroundArea; } private static CompositionPath GetBackgroundPath(SKPoint[] radii, Rect area)