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

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: rebase 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
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/GrTextBlobCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextBlobCache.h
diff --git a/src/gpu/GrTextBlobCache.h b/src/gpu/GrTextBlobCache.h
index 0d0320e00b81b06294b25fb2c1c0373aed01a813..a110a031ab866d14a0f5d1fef8fddcc6d1295121 100644
--- a/src/gpu/GrTextBlobCache.h
+++ b/src/gpu/GrTextBlobCache.h
@@ -40,22 +40,34 @@ public:
return cacheBlob;
}
- BitmapTextBlob* createCachedBlob(const SkTextBlob* blob, size_t maxVAStride) {
+ BitmapTextBlob* createCachedBlob(const SkTextBlob* blob,
+ const BitmapTextBlob::Key& key,
+ const SkMaskFilter::BlurRec& blurRec,
+ const SkPaint& paint,
+ 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;
+ 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();
+ }
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();
}
@@ -71,7 +83,7 @@ public:
BitmapTextBlob* lruBlob = iter.get();
SkASSERT(lruBlob);
while (fPool.size() > kBudget && (lruBlob = iter.get()) && lruBlob != blob) {
- fCache.remove(lruBlob->fUniqueID);
+ fCache.remove(lruBlob->fKey);
// Backup the iterator before removing and unrefing the blob
iter.prev();
@@ -120,7 +132,7 @@ private:
static const int kMinGrowthSize = 1 << 17;
static const int kBudget = 1 << 22;
BitmapBlobList fBlobList;
- SkTDynamicHash<BitmapTextBlob, uint32_t> fCache;
+ SkTDynamicHash<BitmapTextBlob, BitmapTextBlob::Key> fCache;
GrMemoryPool fPool;
PFOverBudgetCB fCallback;
void* fData;
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/GrTextBlobCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698