diff options
author | bsalomon <bsalomon@google.com> | 2014-10-09 09:57:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-09 09:57:18 -0700 |
commit | 1e2530babb65a883a01df5ee87147432f6707ce3 (patch) | |
tree | 01ee9574c04082db140cbb07cbe09575bf9481b8 /include | |
parent | cf9b87389fa6f209617afbb1e62b9d9c36a2a374 (diff) |
Use presence of a content key as non-scratch indicator
BUG=skia:2889
Committed: https://skia.googlesource.com/skia/+/9eefe0851eeaa8ded05b4774ebcb38ed201d5dbf
Review URL: https://codereview.chromium.org/639873002
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrGpuResource.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h index 00a5035107..9b298dd2a6 100644 --- a/include/gpu/GrGpuResource.h +++ b/include/gpu/GrGpuResource.h @@ -70,7 +70,7 @@ public: } protected: - GrIORef() : fRefCnt(1), fPendingReads(0), fPendingWrites(0), fIsScratch(kNo_IsScratch) { } + GrIORef() : fRefCnt(1), fPendingReads(0), fPendingWrites(0) { } bool internalHasPendingRead() const { return SkToBool(fPendingReads); } bool internalHasPendingWrite() const { return SkToBool(fPendingWrites); } @@ -118,16 +118,7 @@ private: // This class is used to manage conversion of refs to pending reads/writes. friend class GrGpuResourceRef; - - // This is temporary until GrResourceCache is fully replaced by GrResourceCache2. - enum IsScratch { - kNo_IsScratch, - kYes_IsScratch - } fIsScratch; - - friend class GrContext; // to set the above field. - friend class GrResourceCache; // to check the above field. - friend class GrResourceCache2; // to check the above field. + friend class GrResourceCache2; // to check IO ref counts. template <typename, GrIOType> friend class GrPendingIOResource; }; @@ -183,6 +174,7 @@ public: void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEntry; } GrResourceCacheEntry* getCacheEntry() const { return fCacheEntry; } + bool isScratch() const; /** * If this resource can be used as a scratch resource this returns a valid @@ -190,6 +182,12 @@ public: */ const GrResourceKey& getScratchKey() const { return fScratchKey; } + /** + * If this resource is currently cached by its contents then this will return + * the content key. Otherwise, NULL is returned. + */ + const GrResourceKey* getContentKey() const; + /** * Gets an id that is unique for this GrGpuResource object. It is static in that it does * not change when the content of the GrGpuResource object changes. This will never return |