Skip to content

Commit

Permalink
Update AvaloniaPicture.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed May 10, 2023
1 parent 2e35ea3 commit 2bbdd02
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Avalonia.Svg/AvaloniaPicture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ namespace Avalonia.Svg;

public sealed class AvaloniaPicture : IDisposable
{
private static AP.IPlatformRenderInterface? Factory => A.AvaloniaLocator.Current?.GetService<AP.IPlatformRenderInterface>();

private readonly List<DrawCommand> _commands;

public IReadOnlyList<DrawCommand> Commands => _commands;
Expand Down Expand Up @@ -58,8 +56,8 @@ private static void RecordPathCommand(DrawPathCanvasCommand drawPathCanvasComman
case AddOvalPathCommand addOvalPathCommand:
{
var rect = addOvalPathCommand.Rect.ToRect();
var ellipseGeometry = Factory?.CreateEllipseGeometry(rect);
commands.Add(new GeometryDrawCommand(brush, pen, ellipseGeometry));
var ellipseGeometry = new AM.EllipseGeometry(rect);
commands.Add(new GeometryDrawCommand(brush, pen, ellipseGeometry.PlatformImpl));
success = true;
break;
}
Expand All @@ -69,8 +67,8 @@ private static void RecordPathCommand(DrawPathCanvasCommand drawPathCanvasComman
var y = addCirclePathCommand.Y;
var radius = addCirclePathCommand.Radius;
var rect = new A.Rect(x - radius, y - radius, radius + radius, radius + radius);
var ellipseGeometry = Factory?.CreateEllipseGeometry(rect);
commands.Add(new GeometryDrawCommand(brush, pen, ellipseGeometry));
var ellipseGeometry = new AM.EllipseGeometry(rect);
commands.Add(new GeometryDrawCommand(brush, pen, ellipseGeometry.PlatformImpl));
success = true;
break;
}
Expand Down Expand Up @@ -173,7 +171,7 @@ private static void RecordCommand(CanvasCommand canvasCommand, List<DrawCommand>
{
var source = drawImageCanvasCommand.Source.ToRect();
var dest = drawImageCanvasCommand.Dest.ToRect();
var bitmapInterpolationMode = drawImageCanvasCommand.Paint?.FilterQuality.ToBitmapInterpolationMode() ?? AVMI.BitmapInterpolationMode.Default;
var bitmapInterpolationMode = drawImageCanvasCommand.Paint?.FilterQuality.ToBitmapInterpolationMode() ?? AVMI.BitmapInterpolationMode.None;
commands.Add(new ImageDrawCommand(image, source, dest, bitmapInterpolationMode));
}
}
Expand Down Expand Up @@ -285,11 +283,11 @@ private void Draw(AM.DrawingContext context, DrawCommand command, Stack<Stack<ID
{
if (imageDrawCommand.Source is { })
{
// TODO: imageDrawCommand.BitmapInterpolationMode
context.DrawImage(
imageDrawCommand.Source,
imageDrawCommand.SourceRect,
imageDrawCommand.DestRect,
imageDrawCommand.BitmapInterpolationMode);
imageDrawCommand.DestRect);
}
break;
}
Expand Down

0 comments on commit 2bbdd02

Please sign in to comment.