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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // check if we clipped out | 141 // check if we clipped out |
142 if (true || NULL == glyph->fAtlas) { | 142 if (true || NULL == glyph->fAtlas) { |
143 int x = vx >> 16; | 143 int x = vx >> 16; |
144 int y = vy >> 16; | 144 int y = vy >> 16; |
145 if (fClipRect.quickReject(x, y, x + width, y + height)) { | 145 if (fClipRect.quickReject(x, y, x + width, y + height)) { |
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 GrDrawTarget::DrawToken drawToken = fDrawTarget->getCurrentDrawToken(); |
151 if (NULL == glyph->fAtlas) { | 152 if (NULL == glyph->fAtlas) { |
152 if (fStrike->getGlyphAtlas(glyph, scaler)) { | 153 if (fStrike->getGlyphAtlas(glyph, scaler, drawToken)) { |
153 goto HAS_ATLAS; | 154 goto HAS_ATLAS; |
154 } | 155 } |
155 | 156 |
156 // try to clear out an unused atlas before we flush | 157 // try to clear out an unused atlas before we flush |
157 fContext->getFontCache()->freeAtlasExceptFor(fStrike); | 158 fContext->getFontCache()->freeAtlasExceptFor(fStrike); |
158 if (fStrike->getGlyphAtlas(glyph, scaler)) { | 159 if (fStrike->getGlyphAtlas(glyph, scaler, drawToken)) { |
159 goto HAS_ATLAS; | 160 goto HAS_ATLAS; |
160 } | 161 } |
161 | 162 |
162 // before we purge the cache, we must flush any accumulated draws | 163 // before we purge the cache, we must flush any accumulated draws |
163 this->flushGlyphs(); | 164 this->flushGlyphs(); |
164 fContext->flush(); | 165 fContext->flush(); |
165 | 166 |
166 // try to purge | 167 // try to purge |
167 fContext->getFontCache()->purgeExceptFor(fStrike); | 168 fContext->getFontCache()->purgeExceptFor(fStrike); |
168 if (fStrike->getGlyphAtlas(glyph, scaler)) { | 169 // need to use new flush count here |
| 170 if (fStrike->getGlyphAtlas(glyph, scaler, drawToken)) { |
169 goto HAS_ATLAS; | 171 goto HAS_ATLAS; |
170 } | 172 } |
171 | 173 |
172 if (NULL == glyph->fPath) { | 174 if (NULL == glyph->fPath) { |
173 SkPath* path = SkNEW(SkPath); | 175 SkPath* path = SkNEW(SkPath); |
174 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { | 176 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { |
175 // flag the glyph as being dead? | 177 // flag the glyph as being dead? |
176 delete path; | 178 delete path; |
177 return; | 179 return; |
178 } | 180 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 SkFixedToFloat(vx + width), | 248 SkFixedToFloat(vx + width), |
247 SkFixedToFloat(vy + height), | 249 SkFixedToFloat(vy + height), |
248 2 * sizeof(SkPoint)); | 250 2 * sizeof(SkPoint)); |
249 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), | 251 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), |
250 SkFixedToFloat(texture->normalizeFixed
Y(ty)), | 252 SkFixedToFloat(texture->normalizeFixed
Y(ty)), |
251 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), | 253 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), |
252 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), | 254 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), |
253 2 * sizeof(SkPoint)); | 255 2 * sizeof(SkPoint)); |
254 fCurrVertex += 4; | 256 fCurrVertex += 4; |
255 } | 257 } |
OLD | NEW |