Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkGraphics Class Reference

Public Types

typedef std::unique_ptr
< SkImageGenerator >(* 
ImageGeneratorFromEncodedDataFactory )(sk_sp< SkData >)
 

Static Public Member Functions

static void Init ()
 Call this at process initialization time if your environment does not permit static global initializers that execute code. More...
 
static void Term ()
 
static void GetVersion (int32_t *major, int32_t *minor, int32_t *patch)
 Return the version numbers for the library. More...
 
static size_t GetFontCacheLimit ()
 Return the max number of bytes that should be used by the font cache. More...
 
static size_t SetFontCacheLimit (size_t bytes)
 Specify the max number of bytes that should be used by the font cache. More...
 
static size_t GetFontCacheUsed ()
 Return the number of bytes currently used by the font cache.
 
static int GetFontCacheCountUsed ()
 Return the number of entries in the font cache. More...
 
static int GetFontCacheCountLimit ()
 Return the current limit to the number of entries in the font cache. More...
 
static int SetFontCacheCountLimit (int count)
 Set the limit to the number of entries in the font cache, and return the previous value. More...
 
static int GetFontCachePointSizeLimit ()
 
static int SetFontCachePointSizeLimit (int maxPointSize)
 
static void PurgeFontCache ()
 For debugging purposes, this will attempt to purge the font cache. More...
 
static size_t GetResourceCacheTotalBytesUsed ()
 Scaling bitmaps with the kHigh_SkFilterQuality setting is expensive, so the result is saved in the global Scaled Image Cache. More...
 
static size_t GetResourceCacheTotalByteLimit ()
 These functions get/set the memory usage limit for the resource cache, used for temporary bitmaps and other resources. More...
 
static size_t SetResourceCacheTotalByteLimit (size_t newLimit)
 
static void PurgeResourceCache ()
 For debugging purposes, this will attempt to purge the resource cache. More...
 
static size_t GetResourceCacheSingleAllocationByteLimit ()
 When the cachable entry is very lage (e.g. More...
 
static size_t SetResourceCacheSingleAllocationByteLimit (size_t newLimit)
 
static void DumpMemoryStatistics (SkTraceMemoryDump *dump)
 Dumps memory usage of caches using the SkTraceMemoryDump interface. More...
 
static void PurgeAllCaches ()
 Free as much globally cached memory as possible. More...
 
static void SetFlags (const char *flags)
 Applications with command line options may pass optional state, such as cache sizes, here, for instance: font-cache-limit=12345678. More...
 
static size_t GetTLSFontCacheLimit ()
 Return the max number of bytes that should be used by the thread-local font cache. More...
 
static void SetTLSFontCacheLimit (size_t bytes)
 Specify the max number of bytes that should be used by the thread-local font cache. More...
 
static
ImageGeneratorFromEncodedDataFactory 
SetImageGeneratorFromEncodedDataFactory (ImageGeneratorFromEncodedDataFactory)
 To instantiate images from encoded data, first looks at this runtime function-ptr. More...
 

Member Function Documentation

static void SkGraphics::DumpMemoryStatistics ( SkTraceMemoryDump dump)
static

Dumps memory usage of caches using the SkTraceMemoryDump interface.

See SkTraceMemoryDump for usage of this method.

static int SkGraphics::GetFontCacheCountLimit ( )
static

Return the current limit to the number of entries in the font cache.

A cache "entry" is associated with each typeface + pointSize + matrix.

static int SkGraphics::GetFontCacheCountUsed ( )
static

Return the number of entries in the font cache.

A cache "entry" is associated with each typeface + pointSize + matrix.

static size_t SkGraphics::GetFontCacheLimit ( )
static

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 SetFontCacheLimit().

static size_t SkGraphics::GetResourceCacheSingleAllocationByteLimit ( )
static

When the cachable entry is very lage (e.g.

a large scaled bitmap), adding it to the cache can cause most/all of the existing entries to be purged. To avoid the, the client can set a limit for a single allocation. If a cacheable entry would have been cached, but its size exceeds this limit, then we do not attempt to cache it at all.

Zero is the default value, meaning we always attempt to cache entries.

static size_t SkGraphics::GetResourceCacheTotalByteLimit ( )
static

These functions get/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 useage exceeds this limit.

static size_t SkGraphics::GetResourceCacheTotalBytesUsed ( )
static

Scaling bitmaps with the kHigh_SkFilterQuality setting is expensive, so the result is saved in the global Scaled Image Cache.

This function returns the memory usage of the Scaled Image Cache.

static size_t SkGraphics::GetTLSFontCacheLimit ( )
static

Return the max number of bytes that should be used by the thread-local font cache.

If the cache needs to allocate more, it will purge previous entries. This max can be changed by calling SetFontCacheLimit().

If this thread has never called SetTLSFontCacheLimit, or has called it with 0, then this thread is using the shared font cache. In that case, this function will always return 0, and the caller may want to call GetFontCacheLimit.

static void SkGraphics::GetVersion ( int32_t *  major,
int32_t *  minor,
int32_t *  patch 
)
static

Return the version numbers for the library.

If the parameter is not null, it is set to the version number.

static void SkGraphics::Init ( )
static

Call this at process initialization time if your environment does not permit static global initializers that execute code.

Init() is thread-safe and idempotent.

static void SkGraphics::PurgeAllCaches ( )
static

Free as much globally cached memory as possible.

This will purge all private caches in Skia, including font and image caches.

If there are caches associated with GPU context, those will not be affected by this call.

static void SkGraphics::PurgeFontCache ( )
static

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.

static void SkGraphics::PurgeResourceCache ( )
static

For debugging purposes, this will attempt to purge the resource cache.

It does not change the limit.

static void SkGraphics::SetFlags ( const char *  flags)
static

Applications with command line options may pass optional state, such as cache sizes, here, for instance: font-cache-limit=12345678.

The flags format is name=value[;name=value...] with no spaces. This format is subject to change.

static int SkGraphics::SetFontCacheCountLimit ( int  count)
static

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.

static size_t SkGraphics::SetFontCacheLimit ( size_t  bytes)
static

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.

This function returns the previous setting, as if GetFontCacheLimit() had be called before the new limit was set.

static ImageGeneratorFromEncodedDataFactory SkGraphics::SetImageGeneratorFromEncodedDataFactory ( ImageGeneratorFromEncodedDataFactory  )
static

To instantiate images from encoded data, first looks at this runtime function-ptr.

If it exists, it is called to create an SkImageGenerator from SkData. If there is no function-ptr or there is, but it returns NULL, then skia will call its internal default implementation.

Returns the previous factory (which could be NULL).

static void SkGraphics::SetTLSFontCacheLimit ( size_t  bytes)
static

Specify the max number of bytes that should be used by the thread-local font cache.

If this value is 0, then this thread will use the shared global font cache.


The documentation for this class was generated from the following file: