Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: src/core/SkTypefaceCache.h

Issue 1879423002: Remove requestedStyle from SkTypefaceCache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More interesting coverage. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkTypefaceCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/core/SkTypefaceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698