diff --git a/build/Magick.NET-Q16-AnyCPU.props b/build/Magick.NET-Q16-AnyCPU.props
index 4e600a1c11..21d9cdcb1f 100644
--- a/build/Magick.NET-Q16-AnyCPU.props
+++ b/build/Magick.NET-Q16-AnyCPU.props
@@ -1,5 +1,5 @@
-
+
diff --git a/build/SkiaSharp.props b/build/SkiaSharp.props
index 35c979a95e..a43c99e978 100644
--- a/build/SkiaSharp.props
+++ b/build/SkiaSharp.props
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs
index 61944c4dbc..1e1becb1c4 100644
--- a/nukebuild/Build.cs
+++ b/nukebuild/Build.cs
@@ -138,12 +138,13 @@ partial class Build : NukeBuild
});
Target RunRenderTests => _ => _
- .OnlyWhen(() => !Parameters.SkipTests && Parameters.IsRunningOnWindows)
+ .OnlyWhen(() => !Parameters.SkipTests)
.DependsOn(Compile)
.Executes(() =>
{
RunCoreTest("./tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj", true);
- RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", true);
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", true);
});
Target RunDesignerTests => _ => _
diff --git a/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs b/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs
index 5efbc0861e..02b6188fb6 100644
--- a/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs
+++ b/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs
@@ -42,7 +42,8 @@ namespace Avalonia.Skia
{
var framebuffer = _platformSurface.Lock();
var framebufferImageInfo = new SKImageInfo(framebuffer.Size.Width, framebuffer.Size.Height,
- framebuffer.Format.ToSkColorType(), SKAlphaType.Premul);
+ framebuffer.Format.ToSkColorType(),
+ framebuffer.Format == PixelFormat.Rgb565 ? SKAlphaType.Opaque : SKAlphaType.Premul);
CreateSurface(framebufferImageInfo, framebuffer);
diff --git a/src/Skia/Avalonia.Skia/GlRenderTarget.cs b/src/Skia/Avalonia.Skia/GlRenderTarget.cs
index a6269473a6..3360255dae 100644
--- a/src/Skia/Avalonia.Skia/GlRenderTarget.cs
+++ b/src/Skia/Avalonia.Skia/GlRenderTarget.cs
@@ -31,24 +31,18 @@ namespace Avalonia.Skia
var size = session.Size;
var scaling = session.Scaling;
- GRBackendRenderTargetDesc desc = new GRBackendRenderTargetDesc
- {
- Width = size.Width,
- Height = size.Height,
- SampleCount = disp.SampleCount,
- StencilBits = disp.StencilSize,
- Config = GRPixelConfig.Rgba8888,
- Origin=GRSurfaceOrigin.BottomLeft,
- RenderTargetHandle = new IntPtr(fb)
- };
-
- gl.Viewport(0, 0, desc.Width, desc.Height);
+ gl.Viewport(0, 0, size.Width, size.Height);
gl.ClearStencil(0);
gl.ClearColor(0, 0, 0, 0);
gl.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- var surface = SKSurface.Create(_grContext, desc);
-
+ GRBackendRenderTarget renderTarget =
+ new GRBackendRenderTarget(size.Width, size.Height, disp.SampleCount, disp.StencilSize,
+ new GRGlFramebufferInfo((uint)fb, GRPixelConfig.Rgba8888.ToGlSizedFormat()));
+ var surface = SKSurface.Create(_grContext, renderTarget,
+ GRSurfaceOrigin.BottomLeft,
+ GRPixelConfig.Rgba8888.ToColorType());
+
var nfo = new DrawingContextImpl.CreateInfo
{
GrContext = _grContext,
@@ -62,6 +56,7 @@ namespace Avalonia.Skia
{
surface.Canvas.Flush();
surface.Dispose();
+ renderTarget.Dispose();
session.Dispose();
}));
}
diff --git a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs
index 36ccd7930a..eb3a11b2a1 100644
--- a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs
+++ b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs
@@ -41,7 +41,7 @@ namespace Avalonia.Skia
var nfo = new SKImageInfo(size.Width, size.Height, colorType, SKAlphaType.Premul);
var blob = runtimePlatform.AllocBlob(nfo.BytesSize);
- _bitmap.InstallPixels(nfo, blob.Address, nfo.RowBytes, null, s_releaseDelegate, blob);
+ _bitmap.InstallPixels(nfo, blob.Address, nfo.RowBytes, s_releaseDelegate, blob);
}
else
{
diff --git a/tests/Avalonia.RenderTests/Controls/BorderTests.cs b/tests/Avalonia.RenderTests/Controls/BorderTests.cs
index c82d616094..4f4004e159 100644
--- a/tests/Avalonia.RenderTests/Controls/BorderTests.cs
+++ b/tests/Avalonia.RenderTests/Controls/BorderTests.cs
@@ -188,7 +188,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
}
- [Fact]
+ [Win32Fact("Has text")]
public async Task Border_Centers_Content_Horizontally()
{
Decorator target = new Decorator
@@ -215,7 +215,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
CompareImages();
}
- [Fact]
+ [Win32Fact("Has text")]
public async Task Border_Centers_Content_Vertically()
{
Decorator target = new Decorator
@@ -296,7 +296,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
CompareImages();
}
- [Fact]
+ [Win32Fact("Has text")]
public async Task Border_Left_Aligns_Content()
{
Decorator target = new Decorator
@@ -323,7 +323,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
CompareImages();
}
- [Fact]
+ [Win32Fact("Has text")]
public async Task Border_Right_Aligns_Content()
{
Decorator target = new Decorator
@@ -350,7 +350,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
CompareImages();
}
- [Fact]
+ [Win32Fact("Has text")]
public async Task Border_Top_Aligns_Content()
{
Decorator target = new Decorator
@@ -377,7 +377,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
CompareImages();
}
- [Fact]
+ [Win32Fact("Has text")]
public async Task Border_Bottom_Aligns_Content()
{
Decorator target = new Decorator
diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs
index 4c8abd85f7..2efd28c2d5 100644
--- a/tests/Avalonia.RenderTests/TestBase.cs
+++ b/tests/Avalonia.RenderTests/TestBase.cs
@@ -46,6 +46,7 @@ namespace Avalonia.Direct2D1.RenderTests
public TestBase(string outputPath)
{
+ outputPath = outputPath.Replace('\\', Path.DirectorySeparatorChar);
var testPath = GetTestsDirectory();
var testFiles = Path.Combine(testPath, "TestFiles");
#if AVALONIA_SKIA
diff --git a/tests/Avalonia.RenderTests/TestSkip.cs b/tests/Avalonia.RenderTests/TestSkip.cs
new file mode 100644
index 0000000000..75407332e3
--- /dev/null
+++ b/tests/Avalonia.RenderTests/TestSkip.cs
@@ -0,0 +1,21 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using Xunit;
+
+#if AVALONIA_SKIA
+namespace Avalonia.Skia.RenderTests
+#else
+namespace Avalonia.Direct2D1.RenderTests
+#endif
+{
+ public class Win32Fact : FactAttribute
+ {
+ public Win32Fact(string message)
+ {
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ Skip = message;
+ }
+ }
+}
+