diff --git a/src/Avalonia.Layout/Layoutable.cs b/src/Avalonia.Layout/Layoutable.cs index 7624928e4b..5abd6c52f7 100644 --- a/src/Avalonia.Layout/Layoutable.cs +++ b/src/Avalonia.Layout/Layoutable.cs @@ -154,6 +154,11 @@ namespace Avalonia.Layout VerticalAlignmentProperty); } + /// + /// Occurs when a layout pass completes for the control. + /// + public event EventHandler LayoutUpdated; + /// /// Gets or sets the width of the element. /// @@ -357,6 +362,8 @@ namespace Avalonia.Layout IsArrangeValid = true; ArrangeCore(rect); _previousArrange = rect; + + LayoutUpdated?.Invoke(this, EventArgs.Empty); } } diff --git a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs index 4be8662a18..14b958137d 100644 --- a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs +++ b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs @@ -182,9 +182,9 @@ namespace Avalonia.Skia var end = linearGradient.EndPoint.ToPixels(targetSize).ToSKPoint(); // would be nice to cache these shaders possibly? - var shader = SKShader.CreateLinearGradient(start, end, stopColors, stopOffsets, tileMode); - paint.Shader = shader; - shader.Dispose(); + using (var shader = SKShader.CreateLinearGradient(start, end, stopColors, stopOffsets, tileMode)) + paint.Shader = shader; + } else { @@ -198,9 +198,9 @@ namespace Avalonia.Skia //paint.setAlpha(128); // would be nice to cache these shaders possibly? - var shader = SKShader.CreateRadialGradient(center, radius, stopColors, stopOffsets, tileMode); - paint.Shader = shader; - shader.Dispose(); + using (var shader = SKShader.CreateRadialGradient(center, radius, stopColors, stopOffsets, tileMode)) + paint.Shader = shader; + } } @@ -271,8 +271,8 @@ namespace Avalonia.Skia : tileBrush.TileMode == TileMode.FlipY || tileBrush.TileMode == TileMode.FlipXY ? SKShaderTileMode.Mirror : SKShaderTileMode.Repeat; - paint.Shader = SKShader.CreateBitmap(bitmap.Bitmap, tileX, tileY, translation); - paint.Shader.Dispose(); + using (var shader = SKShader.CreateBitmap(bitmap.Bitmap, tileX, tileY, translation)) + paint.Shader = shader; } return rv; diff --git a/tests/Avalonia.RenderTests/Controls/BorderTests.cs b/tests/Avalonia.RenderTests/Controls/BorderTests.cs index 6cc3e63c14..ef33ecad8e 100644 --- a/tests/Avalonia.RenderTests/Controls/BorderTests.cs +++ b/tests/Avalonia.RenderTests/Controls/BorderTests.cs @@ -182,8 +182,6 @@ namespace Avalonia.Direct2D1.RenderTests.Controls #if AVALONIA_CAIRO [Fact(Skip = "Font scaling currently broken on cairo")] -#elif AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for new FormattedText")] #else [Fact] #endif @@ -339,8 +337,6 @@ namespace Avalonia.Direct2D1.RenderTests.Controls #if AVALONIA_CAIRO [Fact(Skip = "Font scaling currently broken on cairo")] -#elif AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for new FormattedText")] #else [Fact] #endif @@ -372,8 +368,6 @@ namespace Avalonia.Direct2D1.RenderTests.Controls #if AVALONIA_CAIRO [Fact(Skip = "Font scaling currently broken on cairo")] -#elif AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for new FormattedText")] #else [Fact] #endif diff --git a/tests/Avalonia.RenderTests/Shapes/PathTests.cs b/tests/Avalonia.RenderTests/Shapes/PathTests.cs index f95be89f99..0fc3246635 100644 --- a/tests/Avalonia.RenderTests/Shapes/PathTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PathTests.cs @@ -300,11 +300,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes await RenderToFile(target); CompareImages(); } -#if AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for https://github.com/mono/SkiaSharp/pull/63")] -#else + [Fact] -#endif public async Task Path_Tick_Scaled() { Decorator target = new Decorator @@ -327,11 +324,7 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes CompareImages(); } -#if AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for https://github.com/mono/SkiaSharp/pull/63")] -#else [Fact] -#endif public async Task Path_Tick_Scaled_Stroke_8px() { Decorator target = new Decorator diff --git a/tests/Avalonia.RenderTests/Shapes/PolygonTests.cs b/tests/Avalonia.RenderTests/Shapes/PolygonTests.cs index d7e166839b..415f0b4e85 100644 --- a/tests/Avalonia.RenderTests/Shapes/PolygonTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PolygonTests.cs @@ -24,8 +24,6 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes #if AVALONIA_CAIRO [Fact(Skip = "Caused by cairo bug")] -#elif AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for https://github.com/mono/SkiaSharp/pull/63")] #else [Fact] #endif @@ -52,8 +50,6 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes #if AVALONIA_CAIRO [Fact(Skip = "Caused by cairo bug")] -#elif AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for https://github.com/mono/SkiaSharp/pull/63")] #else [Fact] #endif diff --git a/tests/Avalonia.RenderTests/Shapes/PolylineTests.cs b/tests/Avalonia.RenderTests/Shapes/PolylineTests.cs index 7b9aac220b..684529dd4b 100644 --- a/tests/Avalonia.RenderTests/Shapes/PolylineTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PolylineTests.cs @@ -24,8 +24,6 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes #if AVALONIA_CAIRO [Fact(Skip = "Caused by cairo bug")] -#elif AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for https://github.com/mono/SkiaSharp/pull/63")] #else [Fact] #endif @@ -54,8 +52,6 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes #if AVALONIA_CAIRO [Fact(Skip = "Caused by cairo bug")] -#elif AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for https://github.com/mono/SkiaSharp/pull/63")] #else [Fact] #endif