| Index: src/gpu/GrDistanceFieldTextContext.cpp
|
| diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
|
| index f296244d3e15932032a5fa52c736bfe56390a079..e5374f2a45abcb0742c0a2c8942ee643a21bce34 100755
|
| --- a/src/gpu/GrDistanceFieldTextContext.cpp
|
| +++ b/src/gpu/GrDistanceFieldTextContext.cpp
|
| @@ -10,13 +10,12 @@
|
| #include "GrBitmapTextContext.h"
|
| #include "GrDrawTarget.h"
|
| #include "GrDrawTargetCaps.h"
|
| +#include "GrFontCache.h"
|
| #include "GrFontScaler.h"
|
| #include "GrGpu.h"
|
| #include "GrIndexBuffer.h"
|
| #include "GrStrokeInfo.h"
|
| #include "GrTexturePriv.h"
|
| -#include "GrTextStrike.h"
|
| -#include "GrTextStrike_impl.h"
|
|
|
| #include "SkAutoKern.h"
|
| #include "SkColorFilter.h"
|
| @@ -435,6 +434,42 @@ void GrDistanceFieldTextContext::setupCoverageEffect(const SkColor& filteredColo
|
|
|
| }
|
|
|
| +inline bool GrDistanceFieldTextContext::uploadGlyph(GrGlyph* glyph, GrFontScaler* scaler) {
|
| + if (!fStrike->glyphTooLargeForAtlas(glyph)) {
|
| + if (fStrike->addGlyphToAtlas(glyph, scaler)) {
|
| + return true;
|
| + }
|
| +
|
| + // try to clear out an unused plot before we flush
|
| + if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
|
| + fStrike->addGlyphToAtlas(glyph, scaler)) {
|
| + return true;
|
| + }
|
| +
|
| + if (c_DumpFontCache) {
|
| +#ifdef SK_DEVELOPER
|
| + fContext->getFontCache()->dump();
|
| +#endif
|
| + }
|
| +
|
| + // before we purge the cache, we must flush any accumulated draws
|
| + this->flush();
|
| + fContext->flush();
|
| +
|
| + // we should have an unused plot now
|
| + if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
|
| + fStrike->addGlyphToAtlas(glyph, scaler)) {
|
| + return true;
|
| + }
|
| +
|
| + // we should never get here
|
| + SkASSERT(false);
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| +
|
| // Returns true if this method handled the glyph, false if needs to be passed to fallback
|
| //
|
| bool GrDistanceFieldTextContext::appendGlyph(GrGlyph::PackedID packed,
|
| @@ -484,35 +519,7 @@ bool GrDistanceFieldTextContext::appendGlyph(GrGlyph::PackedID packed,
|
| return true;
|
| }
|
|
|
| - if (NULL == glyph->fPlot) {
|
| - if (!fStrike->glyphTooLargeForAtlas(glyph)) {
|
| - if (fStrike->addGlyphToAtlas(glyph, scaler)) {
|
| - goto HAS_ATLAS;
|
| - }
|
| -
|
| - // try to clear out an unused plot before we flush
|
| - if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
|
| - fStrike->addGlyphToAtlas(glyph, scaler)) {
|
| - goto HAS_ATLAS;
|
| - }
|
| -
|
| - if (c_DumpFontCache) {
|
| -#ifdef SK_DEVELOPER
|
| - fContext->getFontCache()->dump();
|
| -#endif
|
| - }
|
| -
|
| - // before we purge the cache, we must flush any accumulated draws
|
| - this->flush();
|
| - fContext->flush();
|
| -
|
| - // we should have an unused plot now
|
| - if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
|
| - fStrike->addGlyphToAtlas(glyph, scaler)) {
|
| - goto HAS_ATLAS;
|
| - }
|
| - }
|
| -
|
| + if (NULL == glyph->fPlot && !uploadGlyph(glyph, scaler)) {
|
| if (NULL == glyph->fPath) {
|
| SkPath* path = SkNEW(SkPath);
|
| if (!scaler->getGlyphPath(glyph->glyphID(), path)) {
|
| @@ -540,7 +547,6 @@ bool GrDistanceFieldTextContext::appendGlyph(GrGlyph::PackedID packed,
|
| return true;
|
| }
|
|
|
| -HAS_ATLAS:
|
| SkASSERT(glyph->fPlot);
|
| GrDrawTarget::DrawToken drawToken = fDrawTarget->getCurrentDrawToken();
|
| glyph->fPlot->setDrawToken(drawToken);
|
|
|