Skip to content

SP5 Avalonia: Implement ICustomDrawOperation to improve performance#2859

Merged
swharden merged 3 commits intoScottPlot:mainfrom
oktrue:avalonia-customdrawingop
Aug 10, 2023
Merged

SP5 Avalonia: Implement ICustomDrawOperation to improve performance#2859
swharden merged 3 commits intoScottPlot:mainfrom
oktrue:avalonia-customdrawingop

Conversation

@oktrue
Copy link
Contributor

@oktrue oktrue commented Aug 9, 2023

This PR simplifies rendering logic in Avalonia by using CustomDrawOp instead of WriteableBitmap. So we directly render Plot into control's SkSurface.
This fixes #2818, also AvaPlot is DPI aware now.
This also has a performance impact.
In my case FPS increased from 400-600 to 900-1200 on Windows.

…nnecessary axaml and changed AvaPlot type to Avalonia.Controls.Control.
@swharden
Copy link
Member

swharden commented Aug 9, 2023

Hi @oktrue, this is a fantastic improvement! Thanks for this PR!

@bclehmann if you're available to look this over I'd love your input too. Thanks!
EDIT: Discussed it briefly with them in the Discord #1966

Related, Avalonia has a demo that shows how to create a control using ICustomDrawOperation
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/RenderDemo/Pages/CustomSkiaPage.cs

@swharden swharden requested a review from bclehmann August 9, 2023 23:00
@swharden swharden changed the title SP5 Avalonia using CustomDrawOp SP5 Avalonia: Implement ICustomDrawOperation to improve performance Aug 9, 2023
@swharden swharden enabled auto-merge August 9, 2023 23:10
@swharden swharden disabled auto-merge August 9, 2023 23:11
@swharden swharden requested review from bclehmann and removed request for bclehmann August 9, 2023 23:11
@swharden swharden merged commit 156d5c9 into ScottPlot:main Aug 10, 2023
@oktrue oktrue deleted the avalonia-customdrawingop branch August 19, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SP5 Avalonia: Wrong colors in Android projects

2 participants