Index: src/core/SkTypefaceCache.h |
diff --git a/src/core/SkTypefaceCache.h b/src/core/SkTypefaceCache.h |
index bb2cb85bfc9e1058e579fc0dbf4d8a1bbf7db09a..bf90dae3e2086407cabfc4022bb1ba4f5ba5b190 100644 |
--- a/src/core/SkTypefaceCache.h |
+++ b/src/core/SkTypefaceCache.h |
@@ -10,27 +10,20 @@ |
#ifndef SkTypefaceCache_DEFINED |
#define SkTypefaceCache_DEFINED |
+#include "SkRefCnt.h" |
#include "SkTypeface.h" |
-#include "SkTDArray.h" |
- |
-/* TODO |
- * Provide std way to cache name+requestedStyle aliases to the same typeface. |
- * |
- * The current mechanism ends up create a diff typeface for each one, even if |
- * they map to the same internal obj (e.g. CTFontRef on the mac) |
- */ |
+#include "SkTArray.h" |
class SkTypefaceCache { |
public: |
SkTypefaceCache(); |
- ~SkTypefaceCache(); |
/** |
* 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. |
*/ |
- typedef bool(*FindProc)(SkTypeface*, const SkFontStyle&, void* context); |
+ typedef bool(*FindProc)(SkTypeface*, void* context); |
/** |
* Add a typeface to the cache. This ref()s the typeface, so that the |
@@ -38,7 +31,7 @@ public: |
* whose refcnt is 1 (meaning only the cache is an owner) will be |
* unref()ed. |
*/ |
- void add(SkTypeface*, const SkFontStyle& requested); |
+ void add(SkTypeface*); |
/** |
* Iterate through the cache, calling proc(typeface, ctx) with each |
@@ -63,7 +56,7 @@ public: |
// These are static wrappers around a global instance of a cache. |
- static void Add(SkTypeface*, const SkFontStyle& requested); |
+ static void Add(SkTypeface*); |
static SkTypeface* FindByProcAndRef(FindProc proc, void* ctx); |
static void PurgeAll(); |
@@ -77,11 +70,7 @@ private: |
void purge(int count); |
- struct Rec { |
- SkTypeface* fFace; |
- SkFontStyle fRequestedStyle; |
- }; |
- SkTDArray<Rec> fArray; |
+ SkTArray<sk_sp<SkTypeface>> fTypefaces; |
}; |
#endif |