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

[Windows] Fixes related with Clipping #5224

Merged
merged 1 commit into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/Core/src/Graphics/ShapeDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public void Draw(ICanvas canvas, RectF dirtyRect)

if (path == null)
return;

DrawStrokePath(canvas, rect, path);
ClipPath(canvas, path);
DrawFillPath(canvas, rect, path);
}

Expand Down Expand Up @@ -109,6 +108,8 @@ void DrawFillPath(ICanvas canvas, RectF dirtyRect, PathF path)

canvas.SaveState();

ClipPath(canvas, path);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix CanvasDrawingSession exception.


// Set Fill
var fillPaint = ShapeView.Fill;
canvas.SetFillPaint(fillPaint, dirtyRect);
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Handlers/View/ViewHandlerOfT.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ protected override void RemoveContainer()
oldParent?.Children.Remove(ContainerView);

((WrapperView)ContainerView).Child = null;
((WrapperView)ContainerView).Dispose();
ContainerView = null;

if (oldIndex is int idx && idx >= 0)
Expand Down
7 changes: 7 additions & 0 deletions src/Core/src/Platform/Windows/WrapperView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ internal set

public void Dispose()
{
DisposeClip();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow dynamically removing an existing Clipping (Set Clip = null).

DisposeShadow();
DisposeBorder();
}
Expand Down Expand Up @@ -94,6 +95,12 @@ void UpdateClip()
visual.Clip = geometricClip;
}

void DisposeClip()
{
var visual = ElementCompositionPreview.GetElementVisual(Child);
visual.Clip = null;
}

void DisposeBorder()
{
_borderPath = null;
Expand Down