diff options
Diffstat (limited to 'src/gpu/text/GrTextBlobCache.h')
-rw-r--r-- | src/gpu/text/GrTextBlobCache.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gpu/text/GrTextBlobCache.h b/src/gpu/text/GrTextBlobCache.h index 7a5c3a8c28..eb2789a7c1 100644 --- a/src/gpu/text/GrTextBlobCache.h +++ b/src/gpu/text/GrTextBlobCache.h @@ -23,8 +23,8 @@ public: */ typedef void (*PFOverBudgetCB)(void* data); - GrTextBlobCache(PFOverBudgetCB cb, void* data, uint32_t uniqueID) - : fPool(0u, kMinGrowthSize) + GrTextBlobCache(PFOverBudgetCB cb, void* data, uint32_t uniqueID, bool usePool) + : fPool(usePool ? new GrMemoryPool(0u, kMinGrowthSize) : nullptr) , fCallback(cb) , fData(data) , fBudget(kDefaultBudget) @@ -36,14 +36,14 @@ public: // creates an uncached blob sk_sp<GrAtlasTextBlob> makeBlob(int glyphCount, int runCount) { - return GrAtlasTextBlob::Make(&fPool, glyphCount, runCount); + return GrAtlasTextBlob::Make(fPool, glyphCount, runCount); } sk_sp<GrAtlasTextBlob> makeBlob(const SkTextBlob* blob) { int glyphCount = 0; int runCount = 0; BlobGlyphCount(&glyphCount, &runCount, blob); - return GrAtlasTextBlob::Make(&fPool, glyphCount, runCount); + return GrAtlasTextBlob::Make(fPool, glyphCount, runCount); } sk_sp<GrAtlasTextBlob> makeCachedBlob(const SkTextBlob* blob, @@ -171,10 +171,11 @@ private: } void checkPurge(GrAtlasTextBlob* blob = nullptr); + bool overBudget() const; static const int kMinGrowthSize = 1 << 16; static const int kDefaultBudget = 1 << 22; - GrMemoryPool fPool; + GrMemoryPool* fPool; BitmapBlobList fBlobList; SkTHashMap<uint32_t, BlobIDCacheEntry> fBlobIDCache; PFOverBudgetCB fCallback; |