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

Unwrap multiple layers of themed resources #4558

Merged
merged 7 commits into from
Jan 28, 2024

Conversation

dweymouth
Copy link
Contributor

@dweymouth dweymouth commented Jan 24, 2024

Description:

This PR adds a new unwrapResource function to retrieve the "base" resource from a nested chain of themed resource types, and calls it in the Name and Content functions of all ThemedResource types to achieve two improvements:

  • Avoid multiple calls to svg.Colorize, that allocate excess memory and waste CPU
  • Avoid caching multiple versions of the same SVG rasterization with differing prefix names like "error_foreground_base-resource.svg" and "error_base-resource.svg".

Fixes #(issue)

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@dweymouth dweymouth marked this pull request as ready for review January 24, 2024 03:27
@dweymouth dweymouth added the optimization Tickets that could help Fyne apps run faster label Jan 24, 2024
@dweymouth dweymouth requested a review from Jacalz January 27, 2024 03:26
Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

Thanks

@dweymouth dweymouth merged commit 7bf76c2 into fyne-io:develop Jan 28, 2024
11 checks passed
@dweymouth dweymouth deleted the themed-resource-colorize branch January 28, 2024 22:49
@dweymouth dweymouth added this to the v2.4.5 milestone Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Tickets that could help Fyne apps run faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants