Skip to content
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
9 changes: 8 additions & 1 deletion src/Svg.Model/Drawables/DrawableBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,21 @@ public virtual void DebugDrawBounds(SKCanvas canvas)
| DrawAttributes.Opacity
| DrawAttributes.Filter;

// When a filter references 'SourceGraphic', we must draw the element
// without applying its filter again to avoid infinite recursion.
private const DrawAttributes FilterSourceInput =
DrawAttributes.Filter;

protected virtual void PostProcessChildren(SKRect? clip, SKMatrix totalMatrix)
{
}

SKPicture? IFilterSource.SourceGraphic(SKRect? clip)
{
PostProcessChildren(clip, SKMatrix.Identity);
return RecordGraphic(this, clip, DrawAttributes.None);
// Ignore the element's filter when rendering the source graphic so
// that filter primitives do not recursively re-enter filtering.
return RecordGraphic(this, clip, FilterSourceInput);
}

SKPicture? IFilterSource.BackgroundImage(SKRect? clip) => RecordBackground(this, clip, FilterBackgroundInput);
Expand Down
Loading