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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 if (strike->fNext) { | 42 if (strike->fNext) { |
43 SkASSERT(fTail != strike); | 43 SkASSERT(fTail != strike); |
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 #if SK_DISTANCEFIELD_FONTS |
| 52 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler, bool useDistanceField
) { |
| 53 #else |
51 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) { | 54 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) { |
| 55 #endif |
52 this->validate(); | 56 this->validate(); |
53 | 57 |
54 const Key key(scaler->getKey()); | 58 const Key key(scaler->getKey()); |
55 GrTextStrike* strike = fCache.find(key); | 59 GrTextStrike* strike = fCache.find(key); |
56 if (NULL == strike) { | 60 if (NULL == strike) { |
57 strike = this->generateStrike(scaler, key); | 61 strike = this->generateStrike(scaler, key); |
58 } else if (strike->fPrev) { | 62 } else if (strike->fPrev) { |
59 // Need to put the strike at the head of its dllist, since that is how | 63 // 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 | 64 // we age the strikes for purging (we purge from the back of the list |
61 this->detachStrikeFromList(strike); | 65 this->detachStrikeFromList(strike); |
62 // attach at the head | 66 // attach at the head |
63 fHead->fPrev = strike; | 67 fHead->fPrev = strike; |
64 strike->fNext = fHead; | 68 strike->fNext = fHead; |
65 strike->fPrev = NULL; | 69 strike->fPrev = NULL; |
66 fHead = strike; | 70 fHead = strike; |
67 } | 71 } |
68 | 72 #if SK_DISTANCEFIELD_FONTS |
| 73 strike->fUseDistanceField = useDistanceField; |
| 74 #endif |
69 this->validate(); | 75 this->validate(); |
70 return strike; | 76 return strike; |
71 } | 77 } |
72 | 78 |
73 /////////////////////////////////////////////////////////////////////////////// | 79 /////////////////////////////////////////////////////////////////////////////// |
74 | 80 |
75 /** | 81 /** |
76 * This Key just wraps a glyphID, and matches the protocol need for | 82 * This Key just wraps a glyphID, and matches the protocol need for |
77 * GrTHashTable | 83 * GrTHashTable |
78 */ | 84 */ |
(...skipping 17 matching lines...) Expand all Loading... |
96 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed, | 102 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed, |
97 GrFontScaler* scaler) { | 103 GrFontScaler* scaler) { |
98 GrGlyph* glyph = fCache.find(packed); | 104 GrGlyph* glyph = fCache.find(packed); |
99 if (NULL == glyph) { | 105 if (NULL == glyph) { |
100 glyph = this->generateGlyph(packed, scaler); | 106 glyph = this->generateGlyph(packed, scaler); |
101 } | 107 } |
102 return glyph; | 108 return glyph; |
103 } | 109 } |
104 | 110 |
105 #endif | 111 #endif |
OLD | NEW |