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

Side by Side Diff: src/gpu/GrTextStrike_impl.h

Issue 43383006: Clean up the GrTHashTable API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: boo, default template arguments on a function are C++11... Created 7 years, 1 month 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/gpu/GrTextStrike.cpp ('k') | tests/HashCacheTest.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 2010 Google Inc. 3 * Copyright 2010 Google Inc.
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 10
11 #ifndef GrTextStrike_impl_DEFINED 11 #ifndef GrTextStrike_impl_DEFINED
12 #define GrTextStrike_impl_DEFINED 12 #define GrTextStrike_impl_DEFINED
13 13
14 class GrFontCache::Key { 14 class GrFontCache::Key {
15 public: 15 public:
16 Key(GrFontScaler* scaler) { 16 explicit Key(const GrKey* fontScalarKey) {
17 fFontScalerKey = scaler->getKey(); 17 fFontScalerKey = fontScalarKey;
18 } 18 }
19 19
20 intptr_t getHash() const { return fFontScalerKey->getHash(); } 20 intptr_t getHash() const { return fFontScalerKey->getHash(); }
21 21
22 static bool LT(const GrTextStrike& strike, const Key& key) { 22 static bool LT(const GrTextStrike& strike, const Key& key) {
23 return *strike.getFontScalerKey() < *key.fFontScalerKey; 23 return *strike.getFontScalerKey() < *key.fFontScalerKey;
24 } 24 }
25 static bool EQ(const GrTextStrike& strike, const Key& key) { 25 static bool EQ(const GrTextStrike& strike, const Key& key) {
26 return *strike.getFontScalerKey() == *key.fFontScalerKey; 26 return *strike.getFontScalerKey() == *key.fFontScalerKey;
27 } 27 }
(...skipping 16 matching lines...) Expand all
44 strike->fNext->fPrev = strike->fPrev; 44 strike->fNext->fPrev = strike->fPrev;
45 } else { 45 } else {
46 SkASSERT(fTail == strike); 46 SkASSERT(fTail == strike);
47 fTail = strike->fPrev; 47 fTail = strike->fPrev;
48 } 48 }
49 } 49 }
50 50
51 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) { 51 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) {
52 this->validate(); 52 this->validate();
53 53
54 Key key(scaler); 54 const Key key(scaler->getKey());
55 GrTextStrike* strike = fCache.find(key); 55 GrTextStrike* strike = fCache.find(key);
56 if (NULL == strike) { 56 if (NULL == strike) {
57 strike = this->generateStrike(scaler, key); 57 strike = this->generateStrike(scaler, key);
58 } else if (strike->fPrev) { 58 } else if (strike->fPrev) {
59 // Need to put the strike at the head of its dllist, since that is how 59 // Need to put the strike at the head of its dllist, since that is how
60 // we age the strikes for purging (we purge from the back of the list 60 // we age the strikes for purging (we purge from the back of the list
61 this->detachStrikeFromList(strike); 61 this->detachStrikeFromList(strike);
62 // attach at the head 62 // attach at the head
63 fHead->fPrev = strike; 63 fHead->fPrev = strike;
64 strike->fNext = fHead; 64 strike->fNext = fHead;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed, 96 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed,
97 GrFontScaler* scaler) { 97 GrFontScaler* scaler) {
98 GrGlyph* glyph = fCache.find(packed); 98 GrGlyph* glyph = fCache.find(packed);
99 if (NULL == glyph) { 99 if (NULL == glyph) {
100 glyph = this->generateGlyph(packed, scaler); 100 glyph = this->generateGlyph(packed, scaler);
101 } 101 }
102 return glyph; 102 return glyph;
103 } 103 }
104 104
105 #endif 105 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTextStrike.cpp ('k') | tests/HashCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698