Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skia OpacityMask push and pop methods #6373

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/Skia/Avalonia.Skia/DrawingContextImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,11 @@ public void PopBitmapBlendMode()
public void PushOpacityMask(IBrush mask, Rect bounds)
{
// TODO: This should be disposed
var paint = new SKPaint();
var paint = new SKPaint()
{
IsAntialias = true,
Style = SKPaintStyle.StrokeAndFill
};

Canvas.SaveLayer(paint);
_maskStack.Push(CreatePaint(paint, mask, bounds, true));
Expand All @@ -543,7 +547,14 @@ public void PushOpacityMask(IBrush mask, Rect bounds)
/// <inheritdoc />
public void PopOpacityMask()
{
using (var paint = new SKPaint { BlendMode = SKBlendMode.DstIn })
using (var paint = new SKPaint
{
IsAntialias = true,
Style = SKPaintStyle.StrokeAndFill,
BlendMode = SKBlendMode.DstIn,
Color = new SKColor(0, 0, 0, 255),
ColorFilter = SKColorFilter.CreateLumaColor()
})
{
Canvas.SaveLayer(paint);
using (var paintWrapper = _maskStack.Pop())
Expand Down