| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef GrGpuResourceCacheAccess_DEFINED | 9 #ifndef GrGpuResourceCacheAccess_DEFINED |
| 10 #define GrGpuResourceCacheAccess_DEFINED | 10 #define GrGpuResourceCacheAccess_DEFINED |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 /** | 31 /** |
| 32 * Changes whether the resource counts against the resource cache budget. | 32 * Changes whether the resource counts against the resource cache budget. |
| 33 */ | 33 */ |
| 34 void setBudgeted(bool countsAgainstBudget) { fResource->setBudgeted(countsAg
ainstBudget); } | 34 void setBudgeted(bool countsAgainstBudget) { fResource->setBudgeted(countsAg
ainstBudget); } |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Is the resource currently cached as scratch? This means it has a valid sc
ratch key and does | 37 * Is the resource currently cached as scratch? This means it has a valid sc
ratch key and does |
| 38 * not have a content key. | 38 * not have a content key. |
| 39 */ | 39 */ |
| 40 bool isScratch() const { | 40 bool isScratch() const { |
| 41 SkASSERT(fResource->fScratchKey.isScratch()); | 41 return NULL == this->getContentKey() && fResource->fScratchKey.isValid()
; |
| 42 return NULL == this->getContentKey() && !fResource->fScratchKey.isNullSc
ratch(); | |
| 43 } | 42 } |
| 44 | 43 |
| 45 /** | 44 /** |
| 46 * If this resource can be used as a scratch resource this returns a valid s
cratch key. | 45 * If this resource can be used as a scratch resource this returns a valid s
cratch key. |
| 47 * Otherwise it returns a key for which isNullScratch is true. The resource
may currently be | 46 * Otherwise it returns a key for which isNullScratch is true. The resource
may currently be |
| 48 * used as content resource rather than scratch. Check isScratch(). | 47 * used as a content resource rather than scratch. Check isScratch(). |
| 49 */ | 48 */ |
| 50 const GrResourceKey& getScratchKey() const { return fResource->fScratchKey;
} | 49 const GrScratchKey& getScratchKey() const { return fResource->fScratchKey; } |
| 51 | 50 |
| 52 /** | 51 /** |
| 53 * If the resource has a scratch key, the key will be removed. Since scratch
keys are installed | 52 * If the resource has a scratch key, the key will be removed. Since scratch
keys are installed |
| 54 * at resource creation time, this means the resource will never again be us
ed as scratch. | 53 * at resource creation time, this means the resource will never again be us
ed as scratch. |
| 55 */ | 54 */ |
| 56 void removeScratchKey() const { fResource->removeScratchKey(); } | 55 void removeScratchKey() const { fResource->removeScratchKey(); } |
| 57 | 56 |
| 58 /** | 57 /** |
| 59 * If the resource is currently cached by a content key, the key is returned
, otherwise NULL. | 58 * If the resource is currently cached by a content key, the key is returned
, otherwise NULL. |
| 60 */ | 59 */ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 friend class GrGpuResource; // to construct/copy this type. | 112 friend class GrGpuResource; // to construct/copy this type. |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } | 115 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } |
| 117 | 116 |
| 118 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { | 117 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { |
| 119 return CacheAccess(const_cast<GrGpuResource*>(this)); | 118 return CacheAccess(const_cast<GrGpuResource*>(this)); |
| 120 } | 119 } |
| 121 | 120 |
| 122 #endif | 121 #endif |
| OLD | NEW |