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

Add get_outline_commands_uncached #340

Merged
merged 1 commit into from
Dec 22, 2024
Merged

Add get_outline_commands_uncached #340

merged 1 commit into from
Dec 22, 2024

Conversation

taj-p
Copy link
Contributor

@taj-p taj-p commented Dec 21, 2024

Intent

Add API to get the outline commands for a glyph without caching results into outline_command_cache.

Context

I am trying to build a font renderer for low powered and memory constrained devices. Since I am caching the results myself (storing the commands on the GPU for on-GPU rendering - e.g. the Dobbie Method), an uncached version of getting the outline commands allows me to save some memory and avoid a hashmap lookup.

Extra

I've amended the outline_command_cache value type and swash_outline_commands return type to Box<[T]> to:

  • Signal that commands are immutable once created
  • Ensure the Vec isn't storing any unused capacity (it isn't from my inspection, but, I think it helps enforce that requirement).
  • Saves a tiny amount of memory since we no longer need to store the capacity value

@taj-p taj-p marked this pull request as ready for review December 21, 2024 21:31
@jackpot51 jackpot51 merged commit 81c9666 into pop-os:main Dec 22, 2024
0 of 2 checks passed
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.

2 participants