Skip to content

Commit

Permalink
Move reload invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed Jan 26, 2024
1 parent cc86ed8 commit 6090b70
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/Avalonia.Svg.Skia/SvgImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ void IImage.Draw(DrawingContext context, Rect sourceRect, Rect destRect)
{
var source = Source;

var style = string.Concat(Style, ' ', CurrentStyle);
if (source?.Parameters?.Style != style)
{
source?.ReLoad(new SvgParameters(null, style));
}

if (source?.Picture is null)
{
return;
Expand Down Expand Up @@ -101,9 +95,30 @@ void IImage.Draw(DrawingContext context, Rect sourceRect, Rect destRect)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);

if (change.Property == SourceProperty)
{
// TODO: Invalidate IImage
}

if (change.Property == StyleProperty)
{
var style = string.Concat(Style, ' ', CurrentStyle);

if (Source?.Parameters?.Style != style)
{
Source?.ReLoad(new SvgParameters(null, style));
}
}

if (change.Property == CurrentStyleProperty)
{
var style = string.Concat(Style, ' ', CurrentStyle);

if (Source?.Parameters?.Style != style)
{
Source?.ReLoad(new SvgParameters(null, style));
}
}
}
}

0 comments on commit 6090b70

Please sign in to comment.