diff options
author | 2016-02-10 11:55:52 -0800 | |
---|---|---|
committer | 2016-02-10 11:55:52 -0800 | |
commit | 923037724231f11b9249dbb5bf9688835b5ff9b0 (patch) | |
tree | 8c827edfa396d0116fb4069d2f29f5f2acf81d89 /src/gpu/text/GrTextBlobCache.h | |
parent | 60ae6b0e3299db06f53bf39f96df8a304583b043 (diff) |
Remove GrTextBlobCache/GrAtlasTextBlob friendliness
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1686113002
Review URL: https://codereview.chromium.org/1686113002
Diffstat (limited to 'src/gpu/text/GrTextBlobCache.h')
-rw-r--r-- | src/gpu/text/GrTextBlobCache.h | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/src/gpu/text/GrTextBlobCache.h b/src/gpu/text/GrTextBlobCache.h index 8eee9d13db..e3b2ca73fb 100644 --- a/src/gpu/text/GrTextBlobCache.h +++ b/src/gpu/text/GrTextBlobCache.h @@ -30,40 +30,26 @@ public: ~GrTextBlobCache(); // creates an uncached blob - GrAtlasTextBlob* createBlob(int glyphCount, int runCount, size_t maxVASize); - GrAtlasTextBlob* createBlob(const SkTextBlob* blob, size_t maxVAStride) { + GrAtlasTextBlob* createBlob(int glyphCount, int runCount) { + return GrAtlasTextBlob::Create(&fPool, glyphCount, runCount); + } + GrAtlasTextBlob* createBlob(const SkTextBlob* blob) { int glyphCount = 0; int runCount = 0; BlobGlyphCount(&glyphCount, &runCount, blob); - GrAtlasTextBlob* cacheBlob = this->createBlob(glyphCount, runCount, maxVAStride); + GrAtlasTextBlob* cacheBlob = GrAtlasTextBlob::Create(&fPool, glyphCount, runCount); return cacheBlob; } - static void SetupCacheBlobKey(GrAtlasTextBlob* cacheBlob, - const GrAtlasTextBlob::Key& key, - const SkMaskFilter::BlurRec& blurRec, - const SkPaint& paint) { - cacheBlob->fKey = key; - if (key.fHasBlur) { - cacheBlob->fBlurRec = blurRec; - } - if (key.fStyle != SkPaint::kFill_Style) { - cacheBlob->fStrokeInfo.fFrameWidth = paint.getStrokeWidth(); - cacheBlob->fStrokeInfo.fMiterLimit = paint.getStrokeMiter(); - cacheBlob->fStrokeInfo.fJoin = paint.getStrokeJoin(); - } - } - GrAtlasTextBlob* createCachedBlob(const SkTextBlob* blob, const GrAtlasTextBlob::Key& key, const SkMaskFilter::BlurRec& blurRec, - const SkPaint& paint, - size_t maxVAStride) { + const SkPaint& paint) { int glyphCount = 0; int runCount = 0; BlobGlyphCount(&glyphCount, &runCount, blob); - GrAtlasTextBlob* cacheBlob = this->createBlob(glyphCount, runCount, maxVAStride); - SetupCacheBlobKey(cacheBlob, key, blurRec, paint); + GrAtlasTextBlob* cacheBlob = GrAtlasTextBlob::Create(&fPool, glyphCount, runCount); + cacheBlob->setupKey(key, blurRec, paint); this->add(cacheBlob); return cacheBlob; } @@ -73,7 +59,7 @@ public: } void remove(GrAtlasTextBlob* blob) { - fCache.remove(blob->fKey); + fCache.remove(blob->key()); fBlobList.remove(blob); blob->unref(); } @@ -119,7 +105,7 @@ private: iter.init(fBlobList, BitmapBlobList::Iter::kTail_IterStart); GrAtlasTextBlob* lruBlob = nullptr; while (fPool.size() > fBudget && (lruBlob = iter.get()) && lruBlob != blob) { - fCache.remove(lruBlob->fKey); + fCache.remove(lruBlob->key()); // Backup the iterator before removing and unrefing the blob iter.prev(); |