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

Unified Diff: trunk/src/core/SkGlyphCache.cpp

Issue 12706010: Add SkTypeface* parameter to SkScalerContext (and its callers) (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 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 | « trunk/src/core/SkGlyphCache.h ('k') | trunk/src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/core/SkGlyphCache.cpp
===================================================================
--- trunk/src/core/SkGlyphCache.cpp (revision 8215)
+++ trunk/src/core/SkGlyphCache.cpp (working copy)
@@ -13,6 +13,7 @@
#include "SkPath.h"
#include "SkTemplates.h"
#include "SkTLS.h"
+#include "SkTypeface.h"
//#define SPEW_PURGE_STATUS
//#define USE_CACHE_HASH
@@ -52,12 +53,15 @@
#define METRICS_RESERVE_COUNT 128 // so we don't grow this array a lot
-SkGlyphCache::SkGlyphCache(const SkDescriptor* desc)
- : fGlyphAlloc(kMinGlphAlloc), fImageAlloc(kMinImageAlloc) {
+SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc)
+ : fGlyphAlloc(kMinGlphAlloc)
+ , fImageAlloc(kMinImageAlloc) {
+ SkASSERT(typeface);
+
fPrev = fNext = NULL;
fDesc = desc->copy();
- fScalerContext = SkScalerContext::Create(desc);
+ fScalerContext = typeface->createScalerContext(desc);
fScalerContext->getFontMetrics(NULL, &fFontMetricsY);
// init to 0 so that all of the pointers will be null
@@ -523,9 +527,13 @@
- try to acquire the mutext again
- call a fontscaler (which might call into the cache)
*/
-SkGlyphCache* SkGlyphCache::VisitCache(const SkDescriptor* desc,
+SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
+ const SkDescriptor* desc,
bool (*proc)(const SkGlyphCache*, void*),
void* context) {
+ if (!typeface) {
+ typeface = SkTypeface::GetDefaultTypeface();
+ }
SkASSERT(desc);
SkGlyphCache_Globals& globals = getGlobals();
@@ -558,7 +566,7 @@
ac.release(); // release the mutex now
insideMutex = false; // can't use globals anymore
- cache = SkNEW_ARGS(SkGlyphCache, (desc));
+ cache = SkNEW_ARGS(SkGlyphCache, (typeface, desc));
FOUND_IT:
« no previous file with comments | « trunk/src/core/SkGlyphCache.h ('k') | trunk/src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698