From 46de034f981b1b1268e77b321ee44c87fe339b1e Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 19 Feb 2017 21:21:03 +0300 Subject: [PATCH 1/2] Don't skip tests that are passing now --- tests/Avalonia.RenderTests/Controls/BorderTests.cs | 6 ------ tests/Avalonia.RenderTests/Shapes/PathTests.cs | 11 +---------- tests/Avalonia.RenderTests/Shapes/PolygonTests.cs | 4 ---- tests/Avalonia.RenderTests/Shapes/PolylineTests.cs | 4 ---- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/tests/Avalonia.RenderTests/Controls/BorderTests.cs b/tests/Avalonia.RenderTests/Controls/BorderTests.cs index e960070f82..369f4b3031 100644 --- a/tests/Avalonia.RenderTests/Controls/BorderTests.cs +++ b/tests/Avalonia.RenderTests/Controls/BorderTests.cs @@ -181,8 +181,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 @@ -338,8 +336,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 @@ -371,8 +367,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 2e5d528bce..4a4bf16b5d 100644 --- a/tests/Avalonia.RenderTests/Shapes/PathTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PathTests.cs @@ -299,11 +299,7 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes RenderToFile(target); CompareImages(); } -#if AVALONIA_SKIA_SKIP_FAIL - [Fact(Skip = "Waiting for https://github.com/mono/SkiaSharp/pull/63")] -#else - [Fact] -#endif + public void Path_Tick_Scaled() { Decorator target = new Decorator @@ -326,11 +322,6 @@ 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 void 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 21a48b6b64..0f0debb92d 100644 --- a/tests/Avalonia.RenderTests/Shapes/PolygonTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PolygonTests.cs @@ -23,8 +23,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 @@ -51,8 +49,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 5506b29971..d8ebde5712 100644 --- a/tests/Avalonia.RenderTests/Shapes/PolylineTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PolylineTests.cs @@ -23,8 +23,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 @@ -53,8 +51,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 From 32d307f0320c0339dffed1467cbe53f3f272caef Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 19 Feb 2017 21:21:16 +0300 Subject: [PATCH 2/2] Possible leaks --- src/Skia/Avalonia.Skia/DrawingContextImpl.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs index 0e40f578c0..0b1ef3fea7 100644 --- a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs +++ b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs @@ -162,9 +162,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 { @@ -178,9 +178,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; + } } @@ -209,8 +209,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;