Browse Source

Merge pull request #6374 from wieslawsoltes/GeometryClipAntialiasing

Enable antialiasing for PushGeometryClip
pull/6429/head
Dan Walmsley 5 years ago
committed by GitHub
parent
commit
2234d55549
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Skia/Avalonia.Skia/DrawingContextImpl.cs
  2. 3
      src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs
  3. BIN
      tests/TestFiles/Skia/Controls/CustomRender/GeometryClip.expected.png
  4. BIN
      tests/TestFiles/Skia/GeometryClipping/Geometry_Clip_Clips_Path.expected.png

2
src/Skia/Avalonia.Skia/DrawingContextImpl.cs

@ -506,7 +506,7 @@ namespace Avalonia.Skia
public void PushGeometryClip(IGeometryImpl clip)
{
Canvas.Save();
Canvas.ClipPath(((GeometryImpl)clip).EffectivePath);
Canvas.ClipPath(((GeometryImpl)clip).EffectivePath, SKClipOperation.Intersect, true);
}
/// <inheritdoc />

3
src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs

@ -541,7 +541,8 @@ namespace Avalonia.Direct2D1.Media
ContentBounds = PrimitiveExtensions.RectangleInfinite,
MaskTransform = PrimitiveExtensions.Matrix3x2Identity,
Opacity = 1,
GeometricMask = ((GeometryImpl)clip).Geometry
GeometricMask = ((GeometryImpl)clip).Geometry,
MaskAntialiasMode = AntialiasMode.PerPrimitive
};
var layer = _layerPool.Count != 0 ? _layerPool.Pop() : new Layer(_deviceContext);
_deviceContext.PushLayer(ref parameters, layer);

BIN
tests/TestFiles/Skia/Controls/CustomRender/GeometryClip.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
tests/TestFiles/Skia/GeometryClipping/Geometry_Clip_Clips_Path.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 660 B

Loading…
Cancel
Save