| 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 "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 if (true || NULL == glyph->fPlot) { | 266 if (true || NULL == glyph->fPlot) { |
| 267 int x = vx >> 16; | 267 int x = vx >> 16; |
| 268 int y = vy >> 16; | 268 int y = vy >> 16; |
| 269 if (fClipRect.quickReject(x, y, x + width, y + height)) { | 269 if (fClipRect.quickReject(x, y, x + width, y + height)) { |
| 270 // SkCLZ(3); // so we can set a break-point in the debugger | 270 // SkCLZ(3); // so we can set a break-point in the debugger |
| 271 return; | 271 return; |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 */ | 274 */ |
| 275 if (NULL == glyph->fPlot) { | 275 if (NULL == glyph->fPlot) { |
| 276 if (fStrike->addGlyphToAtlas(glyph, scaler)) { | 276 if (!fStrike->glyphTooLargeForAtlas(glyph)) { |
| 277 goto HAS_ATLAS; | 277 if (fStrike->addGlyphToAtlas(glyph, scaler)) { |
| 278 } | 278 goto HAS_ATLAS; |
| 279 } |
| 279 | 280 |
| 280 // try to clear out an unused plot before we flush | 281 // try to clear out an unused plot before we flush |
| 281 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && | 282 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && |
| 282 fStrike->addGlyphToAtlas(glyph, scaler)) { | 283 fStrike->addGlyphToAtlas(glyph, scaler)) { |
| 283 goto HAS_ATLAS; | 284 goto HAS_ATLAS; |
| 284 } | 285 } |
| 285 | 286 |
| 286 if (c_DumpFontCache) { | 287 if (c_DumpFontCache) { |
| 287 #ifdef SK_DEVELOPER | 288 #ifdef SK_DEVELOPER |
| 288 fContext->getFontCache()->dump(); | 289 fContext->getFontCache()->dump(); |
| 289 #endif | 290 #endif |
| 290 } | 291 } |
| 291 | 292 |
| 292 // before we purge the cache, we must flush any accumulated draws | 293 // before we purge the cache, we must flush any accumulated draws |
| 293 this->flushGlyphs(); | 294 this->flushGlyphs(); |
| 294 fContext->flush(); | 295 fContext->flush(); |
| 295 | 296 |
| 296 // we should have an unused plot now | 297 // we should have an unused plot now |
| 297 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && | 298 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && |
| 298 fStrike->addGlyphToAtlas(glyph, scaler)) { | 299 fStrike->addGlyphToAtlas(glyph, scaler)) { |
| 299 goto HAS_ATLAS; | 300 goto HAS_ATLAS; |
| 301 } |
| 300 } | 302 } |
| 301 | 303 |
| 302 if (NULL == glyph->fPath) { | 304 if (NULL == glyph->fPath) { |
| 303 SkPath* path = SkNEW(SkPath); | 305 SkPath* path = SkNEW(SkPath); |
| 304 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { | 306 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { |
| 305 // flag the glyph as being dead? | 307 // flag the glyph as being dead? |
| 306 delete path; | 308 delete path; |
| 307 return; | 309 return; |
| 308 } | 310 } |
| 309 glyph->fPath = path; | 311 glyph->fPath = path; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 SkScalarToFixed(x) - (glyph.fAdvanceX >> a
lignShift), | 664 SkScalarToFixed(x) - (glyph.fAdvanceX >> a
lignShift), |
| 663 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift), | 665 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift), |
| 664 fontScaler); | 666 fontScaler); |
| 665 } | 667 } |
| 666 pos += scalarsPerPosition; | 668 pos += scalarsPerPosition; |
| 667 } | 669 } |
| 668 } | 670 } |
| 669 | 671 |
| 670 this->finish(); | 672 this->finish(); |
| 671 } | 673 } |
| OLD | NEW |