diff options
Diffstat (limited to 'src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp')
-rw-r--r-- | src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp b/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp index 500ae31703..54001c2628 100644 --- a/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp +++ b/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "GrAtlasManager.h" #include "GrAtlasTextBlob.h" #include "GrTextUtils.h" #include "SkDistanceFieldGen.h" @@ -193,13 +194,14 @@ inline void regen_vertices(char* vertex, const GrGlyph* glyph, size_t vertexStri Regenerator::VertexRegenerator(GrResourceProvider* resourceProvider, GrAtlasTextBlob* blob, int runIdx, int subRunIdx, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color, - GrDeferredUploadTarget* uploadTarget, GrAtlasGlyphCache* glyphCache, - SkAutoGlyphCache* lazyCache) + GrDeferredUploadTarget* uploadTarget, GrGlyphCache* glyphCache, + GrAtlasManager* fullAtlasManager, SkAutoGlyphCache* lazyCache) : fResourceProvider(resourceProvider) , fViewMatrix(viewMatrix) , fBlob(blob) , fUploadTarget(uploadTarget) , fGlyphCache(glyphCache) + , fFullAtlasManager(fullAtlasManager) , fLazyCache(lazyCache) , fRun(&blob->fRuns[runIdx]) , fSubRun(&blob->fRuns[runIdx].fSubRunInfo[subRunIdx]) @@ -207,7 +209,7 @@ Regenerator::VertexRegenerator(GrResourceProvider* resourceProvider, GrAtlasText // Compute translation if any fSubRun->computeTranslation(fViewMatrix, x, y, &fTransX, &fTransY); - // Because the GrAtlasGlyphCache may evict the strike a blob depends on using for + // Because the GrGlyphCache may evict the strike a blob depends on using for // generating its texture coords, we have to track whether or not the strike has // been abandoned. If it hasn't been abandoned, then we can use the GrGlyph*s as is // otherwise we have to get the new strike, and use that to get the correct glyphs. @@ -275,16 +277,17 @@ Regenerator::Result Regenerator::doRegen() { glyph = fBlob->fGlyphs[glyphOffset]; SkASSERT(glyph && glyph->fMaskFormat == fSubRun->maskFormat()); - if (!fGlyphCache->hasGlyph(glyph) && - !strike->addGlyphToAtlas(fResourceProvider, fUploadTarget, fGlyphCache, glyph, + if (!fFullAtlasManager->hasGlyph(glyph) && + !strike->addGlyphToAtlas(fResourceProvider, fUploadTarget, fGlyphCache, + fFullAtlasManager, glyph, fLazyCache->get(), fSubRun->maskFormat())) { fBrokenRun = glyphIdx > 0; result.fFinished = false; return result; } auto tokenTracker = fUploadTarget->tokenTracker(); - fGlyphCache->addGlyphToBulkAndSetUseToken(fSubRun->bulkUseToken(), glyph, - tokenTracker->nextDrawToken()); + fFullAtlasManager->addGlyphToBulkAndSetUseToken(fSubRun->bulkUseToken(), glyph, + tokenTracker->nextDrawToken()); } regen_vertices<regenPos, regenCol, regenTexCoords>(currVertex, glyph, vertexStride, @@ -302,14 +305,14 @@ Regenerator::Result Regenerator::doRegen() { fSubRun->setStrike(strike); } fSubRun->setAtlasGeneration(fBrokenRun - ? GrDrawOpAtlas::kInvalidAtlasGeneration - : fGlyphCache->atlasGeneration(fSubRun->maskFormat())); + ? GrDrawOpAtlas::kInvalidAtlasGeneration + : fFullAtlasManager->atlasGeneration(fSubRun->maskFormat())); } return result; } Regenerator::Result Regenerator::regenerate() { - uint64_t currentAtlasGen = fGlyphCache->atlasGeneration(fSubRun->maskFormat()); + uint64_t currentAtlasGen = fFullAtlasManager->atlasGeneration(fSubRun->maskFormat()); // If regenerate() is called multiple times then the atlas gen may have changed. So we check // this each time. if (fSubRun->atlasGeneration() != currentAtlasGen) { @@ -352,9 +355,9 @@ Regenerator::Result Regenerator::regenerate() { // set use tokens for all of the glyphs in our subrun. This is only valid if we // have a valid atlas generation - fGlyphCache->setUseTokenBulk(*fSubRun->bulkUseToken(), - fUploadTarget->tokenTracker()->nextDrawToken(), - fSubRun->maskFormat()); + fFullAtlasManager->setUseTokenBulk(*fSubRun->bulkUseToken(), + fUploadTarget->tokenTracker()->nextDrawToken(), + fSubRun->maskFormat()); return result; } } |