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 caching to DrawShapedText #3033

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MichaelRumpler
Copy link

Description of Change

This enables a user to set a cache duration. When set to a value > 0, it caches the SKShaper and the SKShaper.Result thus repeated calls with the same font and/or text are faster.

Bugs Fixed

API Changes

Added:

  • public static void SetShaperCacheDuration(this SKCanvas canvas, uint milliseconds)

Behavioral Changes

If the cache duration was set to a value bigger than zero, DrawShapedText will cache the SKShaper and the SKShaper.Result for that amount of milliseconds. Therefore repeated calls with the same SKFont and/or string will be faster.

If the cache duration is set to 0, then the cache will be cleared, all contained SKShaper objects disposed and caching will be disabled.

The default cache duration is 0. So if SetShaperCacheDuration is never called, DrawShapedText works as before.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

Copy link
Contributor

Hey there @MichaelRumpler! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@mattleibow
Copy link
Contributor

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add caching in DrawShapedText
2 participants