Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: src/gpu/GrTextBlobCache.h

Issue 1065293003: Start caching masks / stroke fills for textblobs (Closed) Base URL: https://skia.googlesource.com/skia.git@textblobloopergm
Patch Set: tweak Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrTextBlobCache.h
diff --git a/src/gpu/GrTextBlobCache.h b/src/gpu/GrTextBlobCache.h
index 9e1e26f7e6d7a5341e699af3b5389fcb9dc12f23..a1f73918e741f4b78b4cb05f911f668d92ec577b 100644
--- a/src/gpu/GrTextBlobCache.h
+++ b/src/gpu/GrTextBlobCache.h
@@ -29,22 +29,24 @@ public:
return cacheBlob;
}
- BitmapTextBlob* createCachedBlob(const SkTextBlob* blob, size_t maxVAStride) {
+ BitmapTextBlob* createCachedBlob(const SkTextBlob* blob,
+ BitmapTextBlob::Key& key,
+ size_t maxVAStride) {
int glyphCount = 0;
int runCount = 0;
BlobGlyphCount(&glyphCount, &runCount, blob);
BitmapTextBlob* cacheBlob = this->createBlob(glyphCount, runCount, maxVAStride);
- cacheBlob->fUniqueID = blob->uniqueID();
+ cacheBlob->fKey = key;
this->add(cacheBlob);
return cacheBlob;
}
- BitmapTextBlob* find(uint32_t uniqueID) {
- return fCache.find(uniqueID);
+ BitmapTextBlob* find(const BitmapTextBlob::Key& key) {
+ return fCache.find(key);
}
void remove(BitmapTextBlob* blob) {
- fCache.remove(blob->fUniqueID);
+ fCache.remove(blob->fKey);
fBlobList.remove(blob);
blob->unref();
}
@@ -60,7 +62,7 @@ public:
BitmapTextBlob* lruBlob = iter.get();
SkASSERT(lruBlob);
do {
- fCache.remove(lruBlob->fUniqueID);
+ fCache.remove(lruBlob->fKey);
fBlobList.remove(lruBlob);
lruBlob->unref();
iter.prev();
@@ -88,7 +90,7 @@ private:
typedef SkTInternalLList<BitmapTextBlob> BitmapBlobList;
BitmapBlobList fBlobList;
- SkTDynamicHash<BitmapTextBlob, uint32_t> fCache;
+ SkTDynamicHash<BitmapTextBlob, BitmapTextBlob::Key> fCache;
GrMemoryPool fPool;
size_t fBudget;
};

Powered by Google App Engine
This is Rietveld 408576698