25 if (fTypefaces.
size() >= limit) {
26 this->purge(limit >> 2);
35 if (proc(typeface.get(), ctx)) {
42void SkTypefaceCache::purge(
int numToPurge) {
46 if (fTypefaces[
i]->unique()) {
49 if (--numToPurge == 0) {
59 this->purge(fTypefaces.
size());
70 static std::atomic<int32_t> nextID{1};
71 return nextID.fetch_add(1, std::memory_order_relaxed);
75 static SkMutex& mutex = *(
new SkMutex);
81 Get().
add(std::move(face));
97static bool DumpProc(
SkTypeface* face,
void* ctx) {
102 SkDebugf(
"SkTypefaceCache: face %p typefaceID %u weight %d width %d style %d name %s\n",
103 face,
id,
s.weight(),
s.width(),
s.slant(), n.
c_str());
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkMutex & typeface_cache_mutex()
static int GetTypefaceCacheCountLimit()
const char * c_str() const
static sk_sp< SkTypeface > FindByProcAndRef(FindProc proc, void *ctx)
sk_sp< SkTypeface > findByProcAndRef(FindProc proc, void *ctx) const
void add(sk_sp< SkTypeface >)
static void Add(sk_sp< SkTypeface >)
static SkTypefaceID NewTypefaceID()
SkTypefaceID uniqueID() const
void getFamilyName(SkString *name) const
SkFontStyle fontStyle() const
void removeShuffle(int n)
T & emplace_back(Args &&... args)
static thread_local void * gCache