ccpr: Cache paths with >=50% visibility
Adds a hit count to cache entries. Paths now don't get stashed until
their second hit (and cached on their third). Mostly-visible, cachable
paths render their entire mask on the second hit, in hopes that we
will be able to cache them alongside the fully visible ones.
Bug: skia:
Change-Id: Idd18f5dc3090f13531f630d229f4808198695fea
Reviewed-on: https://skia-review.googlesource.com/136541
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCCPathCache.cpp b/src/gpu/ccpr/GrCCPathCache.cpp
index 36e824e..b6eb82a 100644
--- a/src/gpu/ccpr/GrCCPathCache.cpp
+++ b/src/gpu/ccpr/GrCCPathCache.cpp
@@ -114,7 +114,9 @@
if (HashNode* node = fHashTable.find({keyData.get()})) {
entry = node->entry();
SkASSERT(this == entry->fCacheWeakPtr);
- if (!fuzzy_equals(m, entry->fMaskTransform)) {
+ if (fuzzy_equals(m, entry->fMaskTransform)) {
+ ++entry->fHitCount;
+ } else {
this->evict(entry); // The path was reused with an incompatible matrix.
entry = nullptr;
}