OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "GrDistanceFieldTextContext.h" | 8 #include "GrDistanceFieldTextContext.h" |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (true || NULL == glyph->fPlot) { | 154 if (true || NULL == glyph->fPlot) { |
155 int x = vx >> 16; | 155 int x = vx >> 16; |
156 int y = vy >> 16; | 156 int y = vy >> 16; |
157 if (fClipRect.quickReject(x, y, x + width, y + height)) { | 157 if (fClipRect.quickReject(x, y, x + width, y + height)) { |
158 // SkCLZ(3); // so we can set a break-point in the debugger | 158 // SkCLZ(3); // so we can set a break-point in the debugger |
159 return; | 159 return; |
160 } | 160 } |
161 } | 161 } |
162 */ | 162 */ |
163 if (NULL == glyph->fPlot) { | 163 if (NULL == glyph->fPlot) { |
164 if (fStrike->getGlyphAtlas(glyph, scaler)) { | 164 if (fStrike->addGlyphToAtlas(glyph, scaler)) { |
165 goto HAS_ATLAS; | 165 goto HAS_ATLAS; |
166 } | 166 } |
167 | 167 |
168 // try to clear out an unused plot before we flush | 168 // try to clear out an unused plot before we flush |
169 fContext->getFontCache()->freePlotExceptFor(fStrike); | 169 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && |
170 if (fStrike->getGlyphAtlas(glyph, scaler)) { | 170 fStrike->addGlyphToAtlas(glyph, scaler)) { |
171 goto HAS_ATLAS; | 171 goto HAS_ATLAS; |
172 } | 172 } |
173 | 173 |
174 if (c_DumpFontCache) { | 174 if (c_DumpFontCache) { |
175 #ifdef SK_DEVELOPER | 175 #ifdef SK_DEVELOPER |
176 fContext->getFontCache()->dump(); | 176 fContext->getFontCache()->dump(); |
177 #endif | 177 #endif |
178 } | 178 } |
179 | 179 |
180 // before we purge the cache, we must flush any accumulated draws | 180 // before we purge the cache, we must flush any accumulated draws |
181 this->flushGlyphs(); | 181 this->flushGlyphs(); |
182 fContext->flush(); | 182 fContext->flush(); |
183 | 183 |
184 // try to purge | 184 // we should have an unused plot now |
185 fContext->getFontCache()->purgeExceptFor(fStrike); | 185 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && |
186 // need to use new flush count here | 186 fStrike->addGlyphToAtlas(glyph, scaler)) { |
187 if (fStrike->getGlyphAtlas(glyph, scaler)) { | |
188 goto HAS_ATLAS; | 187 goto HAS_ATLAS; |
189 } | 188 } |
190 | 189 |
191 if (NULL == glyph->fPath) { | 190 if (NULL == glyph->fPath) { |
192 SkPath* path = SkNEW(SkPath); | 191 SkPath* path = SkNEW(SkPath); |
193 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { | 192 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { |
194 // flag the glyph as being dead? | 193 // flag the glyph as being dead? |
195 delete path; | 194 delete path; |
196 return; | 195 return; |
197 } | 196 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift) | 442 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift) |
444 + SK_FixedHalf, //d1g.fHalfSampleY, | 443 + SK_FixedHalf, //d1g.fHalfSampleY, |
445 fontScaler); | 444 fontScaler); |
446 } | 445 } |
447 pos += scalarsPerPosition; | 446 pos += scalarsPerPosition; |
448 } | 447 } |
449 } | 448 } |
450 | 449 |
451 this->finish(); | 450 this->finish(); |
452 } | 451 } |
OLD | NEW |