From b4c507e03386f2105e33f0c4c09b4a9d0a23196d Mon Sep 17 00:00:00 2001 From: joshualitt Date: Wed, 8 Apr 2015 08:07:59 -0700 Subject: Adding bulk plot reffer to cached textblobs This change will prevent the atlas from evicting glyphs the TextBlob needs. BUG=skia: Committed: https://skia.googlesource.com/skia/+/7281c61e7bc689d484dcbda49be3cef4ce4f11c2 Review URL: https://codereview.chromium.org/1050113004 --- src/gpu/GrBatchFontCache.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/gpu/GrBatchFontCache.cpp') diff --git a/src/gpu/GrBatchFontCache.cpp b/src/gpu/GrBatchFontCache.cpp index c429d539b8..3cd7a64a73 100644 --- a/src/gpu/GrBatchFontCache.cpp +++ b/src/gpu/GrBatchFontCache.cpp @@ -128,10 +128,18 @@ bool GrBatchFontCache::hasGlyph(GrGlyph* glyph) { return this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID); } -void GrBatchFontCache::setGlyphRefToken(GrGlyph* glyph, GrBatchAtlas::BatchToken batchToken) { +void GrBatchFontCache::addGlyphToBulkAndSetUseToken(GrBatchAtlas::BulkUseTokenUpdater* updater, + GrGlyph* glyph, + GrBatchAtlas::BatchToken token) { SkASSERT(glyph); - SkASSERT(this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID)); - this->getAtlas(glyph->fMaskFormat)->setLastRefToken(glyph->fID, batchToken); + updater->add(glyph->fID); + this->getAtlas(glyph->fMaskFormat)->setLastUseToken(glyph->fID, token); +} + +void GrBatchFontCache::setUseTokenBulk(const GrBatchAtlas::BulkUseTokenUpdater& updater, + GrBatchAtlas::BatchToken token, + GrMaskFormat format) { + this->getAtlas(format)->setLastUseTokenBulk(updater, token); } bool GrBatchFontCache::addToAtlas(GrBatchTextStrike* strike, GrBatchAtlas::AtlasID* id, -- cgit v1.2.3