diff options
author | Robert Phillips <robertphillips@google.com> | 2018-03-01 14:28:44 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-01 19:57:34 +0000 |
commit | caf1ebb95f7fea81d416b81beb4b46c25643c714 (patch) | |
tree | 2dbdba2fdb7011deb68c7b22465aa02f911cdb5f /src/gpu/text/GrGlyphCache.cpp | |
parent | 96ee11959c580f62078db2a3b6dc779da6c3f6c0 (diff) |
sk_sp-ify GrGlyphCache
Hopefully, this makes it clearer that the subRuns of the GrAtlasTextBlobs carry a ref on the GrAtlasTextStrikes
Change-Id: I3d612074d98bc26240465f717711b7a2bcecb6ed
Reviewed-on: https://skia-review.googlesource.com/110981
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/text/GrGlyphCache.cpp')
-rw-r--r-- | src/gpu/text/GrGlyphCache.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gpu/text/GrGlyphCache.cpp b/src/gpu/text/GrGlyphCache.cpp index d4440897bc..7d899076b2 100644 --- a/src/gpu/text/GrGlyphCache.cpp +++ b/src/gpu/text/GrGlyphCache.cpp @@ -41,13 +41,13 @@ void GrGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) { StrikeHash::Iter iter(&glyphCache->fCache); for (; !iter.done(); ++iter) { - GrAtlasTextStrike* strike = &*iter; + GrTextStrike* strike = &*iter; strike->removeID(id); // clear out any empty strikes. We will preserve the strike whose call to addToAtlas // triggered the eviction if (strike != glyphCache->fPreserveStrike && 0 == strike->fAtlasedGlyphs) { - glyphCache->fCache.remove(GrAtlasTextStrike::GetKey(*strike)); + glyphCache->fCache.remove(GrTextStrike::GetKey(*strike)); strike->fIsAbandoned = true; strike->unref(); } @@ -246,13 +246,13 @@ static bool get_packed_glyph_df_image(SkGlyphCache* cache, const SkGlyph& glyph, atlas and a position within that texture. */ -GrAtlasTextStrike::GrAtlasTextStrike(const SkDescriptor& key) +GrTextStrike::GrTextStrike(const SkDescriptor& key) : fFontScalerKey(key) , fPool(9/*start allocations at 512 bytes*/) , fAtlasedGlyphs(0) , fIsAbandoned(false) {} -GrAtlasTextStrike::~GrAtlasTextStrike() { +GrTextStrike::~GrTextStrike() { SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); while (!iter.done()) { (*iter).reset(); @@ -260,8 +260,8 @@ GrAtlasTextStrike::~GrAtlasTextStrike() { } } -GrGlyph* GrAtlasTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, - SkGlyphCache* cache) { +GrGlyph* GrTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, + SkGlyphCache* cache) { SkIRect bounds; if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) { if (!get_packed_glyph_df_bounds(cache, skGlyph, &bounds)) { @@ -280,7 +280,7 @@ GrGlyph* GrAtlasTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe return glyph; } -void GrAtlasTextStrike::removeID(GrDrawOpAtlas::AtlasID id) { +void GrTextStrike::removeID(GrDrawOpAtlas::AtlasID id) { SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); while (!iter.done()) { if (id == (*iter).fID) { @@ -292,13 +292,13 @@ void GrAtlasTextStrike::removeID(GrDrawOpAtlas::AtlasID id) { } } -bool GrAtlasTextStrike::addGlyphToAtlas(GrResourceProvider* resourceProvider, - GrDeferredUploadTarget* target, - GrGlyphCache* glyphCache, - GrAtlasManager* fullAtlasManager, - GrGlyph* glyph, - SkGlyphCache* cache, - GrMaskFormat expectedMaskFormat) { +bool GrTextStrike::addGlyphToAtlas(GrResourceProvider* resourceProvider, + GrDeferredUploadTarget* target, + GrGlyphCache* glyphCache, + GrAtlasManager* fullAtlasManager, + GrGlyph* glyph, + SkGlyphCache* cache, + GrMaskFormat expectedMaskFormat) { SkASSERT(glyph); SkASSERT(cache); SkASSERT(fCache.find(glyph->fPackedID)); |