diff --git a/api/Avalonia.Skia.nupkg.xml b/api/Avalonia.Skia.nupkg.xml index ed29e880a4..b275cbff58 100644 --- a/api/Avalonia.Skia.nupkg.xml +++ b/api/Avalonia.Skia.nupkg.xml @@ -1,6 +1,12 @@  + + CP0002 + M:Avalonia.Skia.SkiaSharpExtensions.ToSKFilterQuality(Avalonia.Media.Imaging.BitmapInterpolationMode) + baseline/netstandard2.0/Avalonia.Skia.dll + target/netstandard2.0/Avalonia.Skia.dll + CP0006 M:Avalonia.Skia.ISkiaGpuWithPlatformGraphicsContext.TryGetGrContext diff --git a/build/SkiaSharp.props b/build/SkiaSharp.props index 5b643efab7..74339fb125 100644 --- a/build/SkiaSharp.props +++ b/build/SkiaSharp.props @@ -1,10 +1,5 @@  - - - - - - + diff --git a/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj b/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj index f30056c8d9..d1f77823e2 100644 --- a/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj +++ b/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj @@ -4,6 +4,8 @@ true true true + + $(WarningsAsErrors);CS0618 diff --git a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs index 1fd3493e9c..70d6e2c10f 100644 --- a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs +++ b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs @@ -246,12 +246,12 @@ namespace Avalonia.Skia var d = destRect.ToSKRect(); var paint = SKPaintCache.Shared.Get(); + var samplingOptions = RenderOptions.BitmapInterpolationMode.ToSKSamplingOptions(); paint.Color = new SKColor(255, 255, 255, (byte)(255 * opacity * _currentOpacity)); - paint.FilterQuality = RenderOptions.BitmapInterpolationMode.ToSKFilterQuality(); paint.BlendMode = RenderOptions.BitmapBlendingMode.ToSKBlendMode(); - drawableImage.Draw(this, s, d, paint); + drawableImage.Draw(this, s, d, samplingOptions, paint); SKPaintCache.Shared.ReturnReset(paint); } @@ -844,7 +844,9 @@ namespace Avalonia.Skia /// public Matrix Transform { - get { return _currentTransform ??= Canvas.TotalMatrix.ToAvaloniaMatrix(); } + // There is a Canvas.TotalMatrix (non 4x4 overload), but internally it still uses 4x4 matrix. + // We want to avoid SKMatrix4x4 -> SKMatrix -> Matrix conversion by directly going SKMatrix4x4 -> Matrix. + get { return _currentTransform ??= Canvas.TotalMatrix44.ToAvaloniaMatrix(); } set { CheckLease(); @@ -860,7 +862,9 @@ namespace Avalonia.Skia transform *= _postTransform.Value; } - Canvas.SetMatrix(transform.ToSKMatrix()); + // Canvas.SetMatrix internally uses 4x4 matrix, even with SKMatrix(3x3) overload. + // We want to avoid Matrix -> SKMatrix -> SKMatrix4x4 conversion by directly going Matrix -> SKMatrix4x4. + Canvas.SetMatrix(transform.ToSKMatrix44()); } } @@ -1257,7 +1261,6 @@ namespace Avalonia.Skia using(var shader = tile.ToShader(tileX, tileY, shaderTransform.ToSKMatrix(), new SKRect(0, 0, tile.CullRect.Width, tile.CullRect.Height))) { - paintWrapper.Paint.FilterQuality = SKFilterQuality.None; paintWrapper.Paint.Shader = shader; } } diff --git a/src/Skia/Avalonia.Skia/Gpu/Metal/SkiaMetalApi.cs b/src/Skia/Avalonia.Skia/Gpu/Metal/SkiaMetalApi.cs deleted file mode 100644 index d5e2352e13..0000000000 --- a/src/Skia/Avalonia.Skia/Gpu/Metal/SkiaMetalApi.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Avalonia.Compatibility; -using Avalonia.Platform.Interop; -using SkiaSharp; -using BindingFlags = System.Reflection.BindingFlags; - -namespace Avalonia.Skia.Metal; - -internal unsafe class SkiaMetalApi -{ - delegate* unmanaged[Stdcall] _gr_direct_context_make_metal_with_options; - private delegate* unmanaged[Stdcall] - _gr_backendrendertarget_new_metal; - private readonly ConstructorInfo _contextCtor; - private readonly MethodInfo _contextOptionsToNative; - private readonly ConstructorInfo _renderTargetCtor; - - [DynamicDependency(DynamicallyAccessedMemberTypes.NonPublicConstructors, typeof(GRContext))] - [DynamicDependency(DynamicallyAccessedMemberTypes.NonPublicConstructors, typeof(GRBackendRenderTarget))] - [DynamicDependency(DynamicallyAccessedMemberTypes.NonPublicMethods, typeof(GRContextOptions))] - [DynamicDependency(DynamicallyAccessedMemberTypes.All, "SkiaSharp.GRContextOptionsNative", "SkiaSharp")] - public SkiaMetalApi() - { - // Make sure that skia is loaded - GC.KeepAlive(new SKPaint()); - - // https://github.com/mono/SkiaSharp/blob/25e70a390e2128e5a54d28795365bf9fdaa7161c/binding/SkiaSharp/SkiaApi.cs#L9-L13 - // Note, IsIOS also returns true on MacCatalyst. - var libSkiaSharpPath = OperatingSystemEx.IsIOS() || OperatingSystemEx.IsTvOS() ? - "@rpath/libSkiaSharp.framework/libSkiaSharp" : - "libSkiaSharp"; - var dll = NativeLibraryEx.Load(libSkiaSharpPath, typeof(SKPaint).Assembly); - - IntPtr address; - - if (NativeLibraryEx.TryGetExport(dll, "gr_direct_context_make_metal_with_options", out address)) - { - _gr_direct_context_make_metal_with_options = - (delegate* unmanaged[Stdcall] )address; - } - else - { - throw new InvalidOperationException( - "Unable to export gr_direct_context_make_metal_with_options. Make sure SkiaSharp is up to date."); - } - - if(NativeLibraryEx.TryGetExport(dll, "gr_backendrendertarget_new_metal", out address)) - { - _gr_backendrendertarget_new_metal = - (delegate* unmanaged[Stdcall])address; - } - else - { - throw new InvalidOperationException( - "Unable to export gr_backendrendertarget_new_metal. Make sure SkiaSharp is up to date."); - } - - _contextCtor = typeof(GRContext).GetConstructor( - BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, - new[] { typeof(IntPtr), typeof(bool) }, null) ?? throw new MissingMemberException("GRContext.ctor(IntPtr,bool)"); - - - _renderTargetCtor = typeof(GRBackendRenderTarget).GetConstructor( - BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, - new[] { typeof(IntPtr), typeof(bool) }, null) ?? throw new MissingMemberException("GRContext.ctor(IntPtr,bool)"); - - _contextOptionsToNative = typeof(GRContextOptions).GetMethod("ToNative", - BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) - ?? throw new MissingMemberException("GRContextOptions.ToNative()"); - } - - [UnconditionalSuppressMessage("Trimming", "IL3050", Justification = "We have DynamicDependency above.")] - public GRContext CreateContext(IntPtr device, IntPtr queue, GRContextOptions? options) - { - options ??= new(); - var nativeOptions = _contextOptionsToNative.Invoke(options, null)!; - var gcHandle = GCHandle.Alloc(nativeOptions, GCHandleType.Pinned); - try - { - var context = _gr_direct_context_make_metal_with_options(device, queue, gcHandle.AddrOfPinnedObject()); - if (context == IntPtr.Zero) - throw new InvalidOperationException("Unable to create GRContext from Metal device."); - return (GRContext)_contextCtor.Invoke(new object[] { context, true }); - } - finally - { - gcHandle.Free(); - } - } - - internal struct GRMtlTextureInfoNative - { - public IntPtr Texture; - } - - public GRBackendRenderTarget CreateBackendRenderTarget(int width, int height, int samples, IntPtr texture) - { - var info = new GRMtlTextureInfoNative() { Texture = texture }; - var target = _gr_backendrendertarget_new_metal(width, height, samples, &info); - if (target == IntPtr.Zero) - throw new InvalidOperationException("Unable to create GRBackendRenderTarget"); - return (GRBackendRenderTarget)_renderTargetCtor.Invoke(new object[] { target, true }); - } -} diff --git a/src/Skia/Avalonia.Skia/Gpu/Metal/SkiaMetalGpu.cs b/src/Skia/Avalonia.Skia/Gpu/Metal/SkiaMetalGpu.cs index bfd6e1aa59..8faa754ef8 100644 --- a/src/Skia/Avalonia.Skia/Gpu/Metal/SkiaMetalGpu.cs +++ b/src/Skia/Avalonia.Skia/Gpu/Metal/SkiaMetalGpu.cs @@ -9,14 +9,15 @@ namespace Avalonia.Skia.Metal; internal class SkiaMetalGpu : ISkiaGpu, ISkiaGpuWithPlatformGraphicsContext { - private SkiaMetalApi _api = new(); private GRContext? _context; private readonly IMetalDevice _device; public SkiaMetalGpu(IMetalDevice device, long? maxResourceBytes) { - _context = _api.CreateContext(device.Device, device.CommandQueue, - new GRContextOptions() { AvoidStencilBuffers = true }); + _context = GRContext.CreateMetal( + new GRMtlBackendContext { DeviceHandle = device.Device, QueueHandle = device.CommandQueue, }, + new GRContextOptions { AvoidStencilBuffers = true }) + ?? throw new InvalidOperationException("Unable to create GRContext from Metal device."); _device = device; if (maxResourceBytes.HasValue) _context.SetResourceCacheLimit(maxResourceBytes.Value); @@ -35,7 +36,7 @@ internal class SkiaMetalGpu : ISkiaGpu, ISkiaGpuWithPlatformGraphicsContext public IPlatformGraphicsContext? PlatformGraphicsContext => _device; public IScopedResource TryGetGrContext() => - ScopedResource.Create(_context ?? throw new ObjectDisposedException(nameof(SkiaMetalApi)), + ScopedResource.Create(_context ?? throw new ObjectDisposedException(nameof(SkiaMetalGpu)), EnsureCurrent().Dispose); public ISkiaGpuRenderTarget? TryCreateRenderTarget(IEnumerable surfaces) @@ -72,13 +73,13 @@ internal class SkiaMetalGpu : ISkiaGpu, ISkiaGpuWithPlatformGraphicsContext public ISkiaGpuRenderSession BeginRenderingSession() { var session = (_target ?? throw new ObjectDisposedException(nameof(SkiaMetalRenderTarget))).BeginRendering(); - var backendTarget = _gpu._api.CreateBackendRenderTarget(session.Size.Width, session.Size.Height, - 1, session.Texture); + var backendTarget = new GRBackendRenderTarget(session.Size.Width, session.Size.Height, + new GRMtlTextureInfo(session.Texture)); var surface = SKSurface.Create(_gpu._context!, backendTarget, session.IsYFlipped ? GRSurfaceOrigin.BottomLeft : GRSurfaceOrigin.TopLeft, SKColorType.Bgra8888); - + return new SkiaMetalRenderSession(_gpu, surface, session); } diff --git a/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaExternalObjectsFeature.cs b/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaExternalObjectsFeature.cs index 5c5427b8d9..16f705e088 100644 --- a/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaExternalObjectsFeature.cs +++ b/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaExternalObjectsFeature.cs @@ -93,7 +93,7 @@ internal class VulkanSkiaExternalObjectsFeature : IExternalObjectsRenderInterfac Size = info.MemorySize } }; - using var renderTarget = new GRBackendRenderTarget(_properties.Width, _properties.Height, 1, imageInfo); + using var renderTarget = new GRBackendRenderTarget(_properties.Width, _properties.Height, imageInfo); using var surface = SKSurface.Create(_gpu.GrContext, renderTarget, _properties.TopLeftOrigin ? GRSurfaceOrigin.TopLeft : GRSurfaceOrigin.BottomLeft, _properties.Format == PlatformGraphicsExternalImageFormat.R8G8B8A8UNorm @@ -121,4 +121,4 @@ internal class VulkanSkiaExternalObjectsFeature : IExternalObjectsRenderInterfac public IReadOnlyList SupportedImageHandleTypes => _feature.SupportedImageHandleTypes; public IReadOnlyList SupportedSemaphoreTypes => _feature.SupportedSemaphoreTypes; -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaRenderTarget.cs b/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaRenderTarget.cs index b761d21b4e..c86a1204f3 100644 --- a/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaRenderTarget.cs +++ b/src/Skia/Avalonia.Skia/Gpu/Vulkan/VulkanSkiaRenderTarget.cs @@ -54,7 +54,7 @@ class VulkanSkiaRenderTarget : ISkiaGpuRenderTarget Size = sessionImageInfo.MemorySize } }; - using var renderTarget = new GRBackendRenderTarget(size.Width, size.Height, 1, imageInfo); + using var renderTarget = new GRBackendRenderTarget(size.Width, size.Height, imageInfo); var surface = SKSurface.Create(_gpu.GrContext, renderTarget, session.IsYFlipped ? GRSurfaceOrigin.TopLeft : GRSurfaceOrigin.BottomLeft, session.IsRgba ? SKColorType.Rgba8888 : SKColorType.Bgra8888, SKColorSpace.CreateSrgb()); diff --git a/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs b/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs index be751021d5..9fe6f9d7e3 100644 --- a/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs +++ b/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs @@ -14,7 +14,8 @@ namespace Avalonia.Skia /// Drawing context. /// Source rect. /// Destination rect. + /// Interpolation sampling options. /// Paint to use. - void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKPaint paint); + void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKSamplingOptions samplingOptions, SKPaint paint); } } diff --git a/src/Skia/Avalonia.Skia/ImmutableBitmap.cs b/src/Skia/Avalonia.Skia/ImmutableBitmap.cs index ec645692b2..c8068fb6fa 100644 --- a/src/Skia/Avalonia.Skia/ImmutableBitmap.cs +++ b/src/Skia/Avalonia.Skia/ImmutableBitmap.cs @@ -50,7 +50,7 @@ namespace Avalonia.Skia { SKImageInfo info = new SKImageInfo(destinationSize.Width, destinationSize.Height, SKColorType.Bgra8888); _bitmap = new SKBitmap(info); - src._image.ScalePixels(_bitmap.PeekPixels(), interpolationMode.ToSKFilterQuality()); + src._image.ScalePixels(_bitmap.PeekPixels(), interpolationMode.ToSKSamplingOptions()); _bitmap.SetImmutable(); _image = SKImage.FromBitmap(_bitmap); @@ -95,11 +95,11 @@ namespace Avalonia.Skia if (_bitmap.Width != desired.Width || _bitmap.Height != desired.Height) { - var scaledBmp = _bitmap.Resize(desired, interpolationMode.ToSKFilterQuality()); + var scaledBmp = _bitmap.Resize(desired, interpolationMode.ToSKSamplingOptions()); _bitmap.Dispose(); _bitmap = scaledBmp; } - + _bitmap.SetImmutable(); _image = SKImage.FromBitmap(_bitmap); @@ -171,9 +171,9 @@ namespace Avalonia.Skia } /// - public void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKPaint paint) + public void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKSamplingOptions samplingOptions, SKPaint paint) { - context.Canvas.DrawImage(_image, sourceRect, destRect, paint); + context.Canvas.DrawImage(_image, sourceRect, destRect, samplingOptions, paint); } public PixelFormat? Format => _bitmap?.ColorType.ToAvalonia(); diff --git a/src/Skia/Avalonia.Skia/SkiaSharpExtensions.cs b/src/Skia/Avalonia.Skia/SkiaSharpExtensions.cs index add72caa30..177dbf5cba 100644 --- a/src/Skia/Avalonia.Skia/SkiaSharpExtensions.cs +++ b/src/Skia/Avalonia.Skia/SkiaSharpExtensions.cs @@ -9,22 +9,20 @@ namespace Avalonia.Skia { public static class SkiaSharpExtensions { - public static SKFilterQuality ToSKFilterQuality(this BitmapInterpolationMode interpolationMode) + public static SKSamplingOptions ToSKSamplingOptions(this BitmapInterpolationMode interpolationMode) { - switch (interpolationMode) + return interpolationMode switch { - case BitmapInterpolationMode.Unspecified: - case BitmapInterpolationMode.LowQuality: - return SKFilterQuality.Low; - case BitmapInterpolationMode.MediumQuality: - return SKFilterQuality.Medium; - case BitmapInterpolationMode.HighQuality: - return SKFilterQuality.High; - case BitmapInterpolationMode.None: - return SKFilterQuality.None; - default: - throw new ArgumentOutOfRangeException(nameof(interpolationMode), interpolationMode, null); - } + BitmapInterpolationMode.None => + new SKSamplingOptions(SKFilterMode.Nearest, SKMipmapMode.None), + BitmapInterpolationMode.Unspecified or BitmapInterpolationMode.LowQuality => + new SKSamplingOptions(SKFilterMode.Linear, SKMipmapMode.None), + BitmapInterpolationMode.MediumQuality => + new SKSamplingOptions(SKFilterMode.Linear, SKMipmapMode.Linear), + BitmapInterpolationMode.HighQuality => + new SKSamplingOptions(SKCubicResampler.Mitchell), + _ => throw new ArgumentOutOfRangeException(nameof(interpolationMode), interpolationMode, null) + }; } public static SKBlendMode ToSKBlendMode(this BitmapBlendingMode blendingMode) @@ -146,11 +144,41 @@ namespace Avalonia.Skia return sm; } + public static SKMatrix44 ToSKMatrix44(this Matrix m) + { + var sm = new SKMatrix44 + { + M00 = (float)m.M11, + M01 = (float)m.M12, + M02 = 0, + M03 = (float)m.M13, + M10 = (float)m.M21, + M11 = (float)m.M22, + M12 = 0, + M13 = (float)m.M23, + M20 = 0, + M21 = 0, + M22 = 1, + M23 = 0, + M30 = (float)m.M31, + M31 = (float)m.M32, + M32 = 0, + M33 = (float)m.M33 + }; + + return sm; + } + internal static Matrix ToAvaloniaMatrix(this SKMatrix m) => new( m.ScaleX, m.SkewY, m.Persp0, m.SkewX, m.ScaleY, m.Persp1, m.TransX, m.TransY, m.Persp2); + internal static Matrix ToAvaloniaMatrix(this SKMatrix44 m) => new( + m.M00, m.M01, m.M03, + m.M10, m.M11, m.M13, + m.M30, m.M31, m.M33); + public static SKColor ToSKColor(this Color c) { return new SKColor(c.R, c.G, c.B, c.A); diff --git a/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs b/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs index 27e36d99b3..87aebc2df1 100644 --- a/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs +++ b/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs @@ -2,7 +2,6 @@ using System; using System.IO; using Avalonia.Reactive; using Avalonia.Platform; -using Avalonia.Rendering; using Avalonia.Skia.Helpers; using SkiaSharp; @@ -164,12 +163,12 @@ namespace Avalonia.Skia public bool CanBlit => true; /// - public void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKPaint paint) + public void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKSamplingOptions samplingOptions, SKPaint paint) { using var image = SnapshotImage(); - context.Canvas.DrawImage(image, sourceRect, destRect, paint); + context.Canvas.DrawImage(image, sourceRect, destRect, samplingOptions, paint); } - + /// /// Create Skia image snapshot from a surface. /// diff --git a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs index 313c7e06de..387b84046e 100644 --- a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs +++ b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs @@ -73,7 +73,7 @@ namespace Avalonia.Skia if (bmp.Width != desired.Width || bmp.Height != desired.Height) { - var scaledBmp = bmp.Resize(desired, interpolationMode.ToSKFilterQuality()); + var scaledBmp = bmp.Resize(desired, interpolationMode.ToSKSamplingOptions()); bmp.Dispose(); bmp = scaledBmp; } @@ -118,7 +118,7 @@ namespace Avalonia.Skia public int Version { get; private set; } = 1; /// - public void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKPaint paint) + public void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKSamplingOptions samplingOptions, SKPaint paint) { lock (_lock) { @@ -132,7 +132,7 @@ namespace Avalonia.Skia _image = GetSnapshot(); _imageValid = true; } - context.Canvas.DrawImage(_image, sourceRect, destRect, paint); + context.Canvas.DrawImage(_image, sourceRect, destRect, samplingOptions, paint); } } diff --git a/src/iOS/Avalonia.iOS/Metal/MetalPlatformGraphics.cs b/src/iOS/Avalonia.iOS/Metal/MetalPlatformGraphics.cs index fb5ffc862c..23e5b08b03 100644 --- a/src/iOS/Avalonia.iOS/Metal/MetalPlatformGraphics.cs +++ b/src/iOS/Avalonia.iOS/Metal/MetalPlatformGraphics.cs @@ -2,7 +2,6 @@ using System; using System.Runtime.Versioning; using Avalonia.Platform; using Metal; -using SkiaSharp; namespace Avalonia.iOS.Metal; @@ -33,17 +32,6 @@ internal class MetalPlatformGraphics : IPlatformGraphics return null; } -#if !TVOS - using var queue = device.CreateCommandQueue(); - using var context = GRContext.CreateMetal(new GRMtlBackendContext { Device = device, Queue = queue }); - if (context is null) - { - // Can be null on macCatalyst because of older Skia bug. - // Fixed in SkiaSharp 3.0 - return null; - } -#endif - return new MetalPlatformGraphics(device); } } diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index e808611aec..2e753ec8b4 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -42,13 +42,7 @@ namespace Avalonia.Direct2D1.RenderTests #endif public static FontFamily TestFontFamily = new FontFamily(s_fontUri); -#if AVALONIA_SKIA3 - // TODO: investigate why output is different. - // Most likely we need to use new SKSamplingOptions API, as old filters are broken with SKBitmap. - private const double AllowedError = 0.15; -#else private const double AllowedError = 0.022; -#endif public TestBase(string outputPath) { diff --git a/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj index 60082ce2c8..233160bd36 100644 --- a/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj +++ b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj @@ -5,11 +5,6 @@ true true true - - - true - $(DefineConstants);AVALONIA_SKIA3 - $(DefineConstants);AVALONIA_SKIA2