Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
This enables a user to set a cache duration. When set to a value > 0, it caches the
SKShaper
and theSKShaper.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 theSKShaper
and theSKShaper.Result
for that amount of milliseconds. Therefore repeated calls with the sameSKFont
and/orstring
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