Skip to main content

Module graphics

Module graphics 

Expand description

Global Skia graphics state: initialization and font cache configuration.

Functions§

font_cache_count_limit
Return the current limit to the number of entries in the font cache. A cache “entry” is associated with each typeface + point size + matrix.
font_cache_count_used
Return the number of entries in the font cache. A cache “entry” is associated with each typeface + point size + matrix.
font_cache_limit
Return the max number of bytes that should be used by the font cache. If the cache needs to allocate more, it will purge previous entries. This max can be changed by calling set_font_cache_limit.
font_cache_used
Return the number of bytes currently used by the font cache.
init
Call this at process initialization time if your environment does not permit static global initializers that execute code. init is thread-safe and idempotent.
purge_all_caches
Free as much globally cached memory as possible. This will purge all private caches in Skia, including font and image caches.
purge_font_cache
For debugging purposes, this will attempt to purge the font cache. It does not change the limit, but will cause subsequent font measures and draws to be recreated, since they will no longer be in the cache.
purge_pinned_font_cache
If the strike cache is above the cache limit, attempt to purge strikes with pinners. This should be called after clients release locks on pinned strikes.
purge_resource_cache
For debugging purposes, this will attempt to purge the resource cache. It does not change the limit.
resource_cache_single_allocation_byte_limit
When the cacheable entry is very large, adding it to the cache can cause most or all of the existing entries to be purged. To avoid this, a client can set a limit for a single allocation. If a cacheable entry would have been cached, but its size exceeds this limit, then it is not cached at all.
resource_cache_total_bytes_limit
Get the memory usage limit for the resource cache, used for temporary bitmaps and other resources. Entries are purged from the cache when the memory usage exceeds this limit.
resource_cache_total_bytes_used
Returns the memory used for temporary images and other resources.
set_font_cache_count_limit
Set the limit to the number of entries in the font cache, and return the previous value. If this new value is lower than the previous, it will automatically try to purge entries to meet the new limit.
set_font_cache_limit
Specify the max number of bytes that should be used by the font cache. If the cache needs to allocate more, it will purge previous entries.
set_resource_cache_single_allocation_byte_limit
When the cacheable entry is very large, adding it to the cache can cause most or all of the existing entries to be purged. To avoid this, set a limit for a single allocation. If a cacheable entry would have been cached, but its size exceeds this limit, then it is not cached at all.
set_resource_cache_total_bytes_limit
Set the memory usage limit for the resource cache, used for temporary bitmaps and other resources. Entries are purged from the cache when the memory usage exceeds this limit.
set_typeface_cache_count_limit
Set the limit to the number of entries in the typeface cache, and return the previous value. Changes to this only take effect the next time each cache object is modified.
typeface_cache_count_limit
Return the current limit to the number of entries in the typeface cache. A cache “entry” is associated with each typeface.