OLD | NEW |
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 explicit Key(const GrKey* fontScalarKey) { | 16 explicit Key(const GrFontDescKey* fontScalarKey) { |
17 fFontScalerKey = fontScalarKey; | 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 LessThan(const GrTextStrike& strike, const Key& key) { | 22 static bool LessThan(const GrTextStrike& strike, const Key& key) { |
23 return *strike.getFontScalerKey() < *key.fFontScalerKey; | 23 return *strike.getFontScalerKey() < *key.fFontScalerKey; |
24 } | 24 } |
25 static bool Equals(const GrTextStrike& strike, const Key& key) { | 25 static bool Equals(const GrTextStrike& strike, const Key& key) { |
26 return *strike.getFontScalerKey() == *key.fFontScalerKey; | 26 return *strike.getFontScalerKey() == *key.fFontScalerKey; |
27 } | 27 } |
28 | 28 |
29 private: | 29 private: |
30 const GrKey* fFontScalerKey; | 30 const GrFontDescKey* fFontScalerKey; |
31 }; | 31 }; |
32 | 32 |
33 void GrFontCache::detachStrikeFromList(GrTextStrike* strike) { | 33 void GrFontCache::detachStrikeFromList(GrTextStrike* strike) { |
34 if (strike->fPrev) { | 34 if (strike->fPrev) { |
35 SkASSERT(fHead != strike); | 35 SkASSERT(fHead != strike); |
36 strike->fPrev->fNext = strike->fNext; | 36 strike->fPrev->fNext = strike->fNext; |
37 } else { | 37 } else { |
38 SkASSERT(fHead == strike); | 38 SkASSERT(fHead == strike); |
39 fHead = strike->fNext; | 39 fHead = strike->fNext; |
40 } | 40 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |