diff options
author | Robert Phillips <robertphillips@google.com> | 2018-02-14 18:54:01 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-15 13:23:22 +0000 |
commit | 303cd58870cf1d0d128ff3f37d1dc26778cad5af (patch) | |
tree | 0d063c9072fff57bc50d77e3b15a2247290ec05e /src/gpu/text/GrTextBlobCache.h | |
parent | d5811b2d4423cbf561e6ab8251550543d690f376 (diff) |
Update GrTextBlobCache for DDL
Although, theoretically, we could update the DDLs to maintain pointers to the GrMemoryPools being used by their GrAtlasTextBlobs this method seems simpler.
Change-Id: I4835284630b9cd29eb78cf25bcdfe5c56974a8cb
Reviewed-on: https://skia-review.googlesource.com/107345
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
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; |