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

Side by Side Diff: src/core/SkGlyphCache.cpp

Issue 14940018: we only need one fontmetrics, since the paint (and fontcache) now know explicitly (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkGlyphCache.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkGlyphCache.h" 10 #include "SkGlyphCache.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) 56 SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc)
57 : fGlyphAlloc(kMinGlphAlloc) 57 : fGlyphAlloc(kMinGlphAlloc)
58 , fImageAlloc(kMinImageAlloc) { 58 , fImageAlloc(kMinImageAlloc) {
59 SkASSERT(typeface); 59 SkASSERT(typeface);
60 60
61 fPrev = fNext = NULL; 61 fPrev = fNext = NULL;
62 62
63 fDesc = desc->copy(); 63 fDesc = desc->copy();
64 fScalerContext = typeface->createScalerContext(desc); 64 fScalerContext = typeface->createScalerContext(desc);
65 fScalerContext->getFontMetrics(NULL, &fFontMetricsY); 65 fScalerContext->getFontMetrics(&fFontMetrics);
66 66
67 // init to 0 so that all of the pointers will be null 67 // init to 0 so that all of the pointers will be null
68 memset(fGlyphHash, 0, sizeof(fGlyphHash)); 68 memset(fGlyphHash, 0, sizeof(fGlyphHash));
69 // init with 0xFF so that the charCode field will be -1, which is invalid 69 // init with 0xFF so that the charCode field will be -1, which is invalid
70 memset(fCharToGlyphHash, 0xFF, sizeof(fCharToGlyphHash)); 70 memset(fCharToGlyphHash, 0xFF, sizeof(fCharToGlyphHash));
71 71
72 fMemoryUsed = sizeof(*this) + kMinGlphAlloc + kMinImageAlloc; 72 fMemoryUsed = sizeof(*this) + kMinGlphAlloc + kMinImageAlloc;
73 73
74 fGlyphArray.setReserve(METRICS_RESERVE_COUNT); 74 fGlyphArray.setReserve(METRICS_RESERVE_COUNT);
75 75
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return tls ? tls->getFontCacheLimit() : 0; 742 return tls ? tls->getFontCacheLimit() : 0;
743 } 743 }
744 744
745 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { 745 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) {
746 if (0 == bytes) { 746 if (0 == bytes) {
747 SkGlyphCache_Globals::DeleteTLS(); 747 SkGlyphCache_Globals::DeleteTLS();
748 } else { 748 } else {
749 SkGlyphCache_Globals::GetTLS().setFontCacheLimit(bytes); 749 SkGlyphCache_Globals::GetTLS().setFontCacheLimit(bytes);
750 } 750 }
751 } 751 }
OLDNEW
« no previous file with comments | « src/core/SkGlyphCache.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698