OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 | 9 |
10 #include "GrTextContext.h" | 10 #include "GrTextContext.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // SkCLZ(3); // so we can set a break-point in the debugger | 146 // SkCLZ(3); // so we can set a break-point in the debugger |
147 return; | 147 return; |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 if (NULL == glyph->fAtlas) { | 151 if (NULL == glyph->fAtlas) { |
152 if (fStrike->getGlyphAtlas(glyph, scaler)) { | 152 if (fStrike->getGlyphAtlas(glyph, scaler)) { |
153 goto HAS_ATLAS; | 153 goto HAS_ATLAS; |
154 } | 154 } |
155 | 155 |
| 156 // try to clear out an unused atlas before we flush |
| 157 fContext->getFontCache()->freeAtlasExceptFor(fStrike); |
| 158 if (fStrike->getGlyphAtlas(glyph, scaler)) { |
| 159 goto HAS_ATLAS; |
| 160 } |
| 161 |
156 // before we purge the cache, we must flush any accumulated draws | 162 // before we purge the cache, we must flush any accumulated draws |
157 this->flushGlyphs(); | 163 this->flushGlyphs(); |
158 fContext->flush(); | 164 fContext->flush(); |
159 | 165 |
160 // try to purge | 166 // try to purge |
161 fContext->getFontCache()->purgeExceptFor(fStrike); | 167 fContext->getFontCache()->purgeExceptFor(fStrike); |
162 if (fStrike->getGlyphAtlas(glyph, scaler)) { | 168 if (fStrike->getGlyphAtlas(glyph, scaler)) { |
163 goto HAS_ATLAS; | 169 goto HAS_ATLAS; |
164 } | 170 } |
165 | 171 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 SkFixedToFloat(vx + width), | 246 SkFixedToFloat(vx + width), |
241 SkFixedToFloat(vy + height), | 247 SkFixedToFloat(vy + height), |
242 2 * sizeof(SkPoint)); | 248 2 * sizeof(SkPoint)); |
243 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), | 249 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), |
244 SkFixedToFloat(texture->normalizeFixed
Y(ty)), | 250 SkFixedToFloat(texture->normalizeFixed
Y(ty)), |
245 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), | 251 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), |
246 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), | 252 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), |
247 2 * sizeof(SkPoint)); | 253 2 * sizeof(SkPoint)); |
248 fCurrVertex += 4; | 254 fCurrVertex += 4; |
249 } | 255 } |
OLD | NEW |