diff options
author | Robert Phillips <robertphillips@google.com> | 2018-02-21 12:31:17 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-21 18:35:16 +0000 |
commit | 038c608a8658cb6413981b7d3c9368e8245b6384 (patch) | |
tree | bc2ae27794fae0f303eb5f90bd9e11096030a496 /src/gpu/text | |
parent | 955b3d55808117f45e24de1db1e245b5491897ea (diff) |
Remove back pointer to GrAtlasGlyphCache from GrAtlasTextStrike
This is calved off from https://skia-review.googlesource.com/c/skia/+/108001 (Fission GrAtlasGlyphCache in two)
In the DDL world, the GrAtlasTextStrikes can outlive their generating GrAtlasGlyphCache.
Change-Id: I52b01d3934b0651a58a59b12dcc4c98ffbb891a9
Reviewed-on: https://skia-review.googlesource.com/109061
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/text')
-rw-r--r-- | src/gpu/text/GrAtlasGlyphCache.cpp | 6 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasGlyphCache.h | 8 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp index c36ad8798d..fb52250781 100644 --- a/src/gpu/text/GrAtlasGlyphCache.cpp +++ b/src/gpu/text/GrAtlasGlyphCache.cpp @@ -399,10 +399,9 @@ static bool get_packed_glyph_df_image(SkGlyphCache* cache, const SkGlyph& glyph, atlas and a position within that texture. */ -GrAtlasTextStrike::GrAtlasTextStrike(GrAtlasGlyphCache* owner, const SkDescriptor& key) +GrAtlasTextStrike::GrAtlasTextStrike(const SkDescriptor& key) : fFontScalerKey(key) , fPool(9/*start allocations at 512 bytes*/) - , fAtlasGlyphCache(owner) // no need to ref, it won't go away before we do , fAtlasedGlyphs(0) , fIsAbandoned(false) {} @@ -447,6 +446,7 @@ void GrAtlasTextStrike::removeID(GrDrawOpAtlas::AtlasID id) { } bool GrAtlasTextStrike::addGlyphToAtlas(GrDeferredUploadTarget* target, + GrAtlasGlyphCache* atlasGlyphCache, GrGlyph* glyph, SkGlyphCache* cache, GrMaskFormat expectedMaskFormat) { @@ -473,7 +473,7 @@ bool GrAtlasTextStrike::addGlyphToAtlas(GrDeferredUploadTarget* target, } } - bool success = fAtlasGlyphCache->addToAtlas(this, &glyph->fID, target, expectedMaskFormat, + bool success = atlasGlyphCache->addToAtlas(this, &glyph->fID, target, expectedMaskFormat, glyph->width(), glyph->height(), storage.get(), &glyph->fAtlasLocation); if (success) { diff --git a/src/gpu/text/GrAtlasGlyphCache.h b/src/gpu/text/GrAtlasGlyphCache.h index aa337c43f5..6175342c26 100644 --- a/src/gpu/text/GrAtlasGlyphCache.h +++ b/src/gpu/text/GrAtlasGlyphCache.h @@ -28,8 +28,7 @@ class GrGpu; */ class GrAtlasTextStrike : public SkNVRefCnt<GrAtlasTextStrike> { public: - /** Owner is the cache that owns this strike. */ - GrAtlasTextStrike(GrAtlasGlyphCache* owner, const SkDescriptor& fontScalerKey); + GrAtlasTextStrike(const SkDescriptor& fontScalerKey); ~GrAtlasTextStrike(); inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, @@ -65,7 +64,7 @@ public: // happen. // TODO we can handle some of these cases if we really want to, but the long term solution is to // get the actual glyph image itself when we get the glyph metrics. - bool addGlyphToAtlas(GrDeferredUploadTarget*, GrGlyph*, SkGlyphCache*, + bool addGlyphToAtlas(GrDeferredUploadTarget*, GrAtlasGlyphCache*, GrGlyph*, SkGlyphCache*, GrMaskFormat expectedMaskFormat); // testing @@ -88,7 +87,6 @@ private: SkAutoDescriptor fFontScalerKey; SkArenaAlloc fPool{512}; - GrAtlasGlyphCache* fAtlasGlyphCache; int fAtlasedGlyphs; bool fIsAbandoned; @@ -246,7 +244,7 @@ private: bool initAtlas(GrMaskFormat); GrAtlasTextStrike* generateStrike(const SkGlyphCache* cache) { - GrAtlasTextStrike* strike = new GrAtlasTextStrike(this, cache->getDescriptor()); + GrAtlasTextStrike* strike = new GrAtlasTextStrike(cache->getDescriptor()); fCache.add(strike); return strike; } diff --git a/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp b/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp index 384596ddb6..1a9c3d73e4 100644 --- a/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp +++ b/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp @@ -274,7 +274,7 @@ Regenerator::Result Regenerator::doRegen() { SkASSERT(glyph && glyph->fMaskFormat == fSubRun->maskFormat()); if (!fGlyphCache->hasGlyph(glyph) && - !strike->addGlyphToAtlas(fUploadTarget, glyph, fLazyCache->get(), + !strike->addGlyphToAtlas(fUploadTarget, fGlyphCache, glyph, fLazyCache->get(), fSubRun->maskFormat())) { fBrokenRun = glyphIdx > 0; result.fFinished = false; |