Flutter Engine
The Flutter Engine
|
#include <SkTypefaceCache.h>
Public Types | |
typedef bool(* | FindProc) (SkTypeface *, void *context) |
Public Member Functions | |
SkTypefaceCache () | |
void | add (sk_sp< SkTypeface >) |
sk_sp< SkTypeface > | findByProcAndRef (FindProc proc, void *ctx) const |
void | purgeAll () |
Static Public Member Functions | |
static SkTypefaceID | NewTypefaceID () |
static void | Add (sk_sp< SkTypeface >) |
static sk_sp< SkTypeface > | FindByProcAndRef (FindProc proc, void *ctx) |
static void | PurgeAll () |
static void | Dump () |
Definition at line 17 of file SkTypefaceCache.h.
typedef bool(* SkTypefaceCache::FindProc) (SkTypeface *, void *context) |
Callback for FindByProc. Returns true if the given typeface is a match for the given context. The passed typeface is owned by the cache and is not additionally ref()ed. The typeface may be in the disposed state.
Definition at line 26 of file SkTypefaceCache.h.
SkTypefaceCache::SkTypefaceCache | ( | ) |
Definition at line 20 of file SkTypefaceCache.cpp.
void SkTypefaceCache::add | ( | sk_sp< SkTypeface > | face | ) |
Add a typeface to the cache. Later, if we need to purge the cache, typefaces uniquely owned by the cache will be unref()ed.
Definition at line 22 of file SkTypefaceCache.cpp.
|
static |
Definition at line 79 of file SkTypefaceCache.cpp.
|
static |
Debugging only: dumps the status of the typefaces in the cache
Definition at line 108 of file SkTypefaceCache.cpp.
|
static |
Definition at line 84 of file SkTypefaceCache.cpp.
sk_sp< SkTypeface > SkTypefaceCache::findByProcAndRef | ( | FindProc | proc, |
void * | ctx | ||
) | const |
Iterate through the cache, calling proc(typeface, ctx) for each typeface. If proc returns true, then return that typeface. If it never returns true, return nullptr.
Definition at line 33 of file SkTypefaceCache.cpp.
|
static |
Helper: returns a unique typefaceID to pass to the constructor of your subclass of SkTypeface
Definition at line 69 of file SkTypefaceCache.cpp.
void SkTypefaceCache::purgeAll | ( | ) |
This will unref all of the typefaces in the cache for which the cache is the only owner. Normally this is handled automatically as needed. This function is exposed for clients that explicitly want to purge the cache (e.g. to look for leaks).
Definition at line 58 of file SkTypefaceCache.cpp.
|
static |
Definition at line 89 of file SkTypefaceCache.cpp.