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

Improve DrawImageAlpha to not use a new Pen every time #2314

Merged
merged 3 commits into from Jun 29, 2022
Merged

Improve DrawImageAlpha to not use a new Pen every time #2314

merged 3 commits into from Jun 29, 2022

Conversation

GoldenretriverYT
Copy link
Contributor

@GoldenretriverYT GoldenretriverYT commented Jun 26, 2022

Currently, Canvas.DrawImageAlpha always creates a new Pen. For every pixel. This PR changes it so that there is one Pen, created at the beginning of the method. Each pixel just changes the color, which improves performance. My kernel with ~15 alpha images went from 15 fps to 24 fps

Copy link
Member

@quajak quajak left a comment

Choose a reason for hiding this comment

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

Nice optimisation! Could you please also add the trick to the normal DrawImage in Canvas.cs

@GoldenretriverYT
Copy link
Contributor Author

Done

Copy link
Member

@quajak quajak left a comment

Choose a reason for hiding this comment

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

Thanks!

@quajak quajak merged commit 67b9c8b into CosmosOS:master Jun 29, 2022
@GoldenretriverYT GoldenretriverYT deleted the patch-DrawImageAlpha branch July 9, 2022 12: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.

None yet

2 participants