| 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 10 matching lines...) Expand all Loading... |
| 21 * Sets a content key for the resource. If the resource was previously cache
d as scratch it will | 21 * Sets a content key for the resource. If the resource was previously cache
d as scratch it will |
| 22 * be converted to a content resource. Currently this may only be called onc
e per resource. It | 22 * be converted to a content resource. Currently this may only be called onc
e per resource. It |
| 23 * fails if there is already a resource with the same content key. TODO: mak
e this supplant the | 23 * fails if there is already a resource with the same content key. TODO: mak
e this supplant the |
| 24 * resource that currently is using the content key, allow resources' conten
t keys to change, | 24 * resource that currently is using the content key, allow resources' conten
t keys to change, |
| 25 * and allow removal of a content key to convert a resource back to scratch. | 25 * and allow removal of a content key to convert a resource back to scratch. |
| 26 */ | 26 */ |
| 27 bool setContentKey(const GrContentKey& contentKey) { | 27 bool setContentKey(const GrContentKey& contentKey) { |
| 28 return fResource->setContentKey(contentKey); | 28 return fResource->setContentKey(contentKey); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void removeContentKey() { return fResource->removeContentKey(); } |
| 32 |
| 31 /** | 33 /** |
| 32 * Is the resource currently cached as scratch? This means it is cached, has
a valid scratch | 34 * Is the resource currently cached as scratch? This means it is cached, has
a valid scratch |
| 33 * key, and does not have a content key. | 35 * key, and does not have a content key. |
| 34 */ | 36 */ |
| 35 bool isScratch() const { | 37 bool isScratch() const { |
| 36 return !fResource->getContentKey().isValid() && fResource->fScratchKey.i
sValid() && | 38 return !fResource->getContentKey().isValid() && fResource->fScratchKey.i
sValid() && |
| 37 this->isBudgeted(); | 39 this->isBudgeted(); |
| 38 } | 40 } |
| 39 | 41 |
| 40 /** | 42 /** |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 friend class GrGpuResource; // to construct/copy this type. | 112 friend class GrGpuResource; // to construct/copy this type. |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } | 115 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } |
| 114 | 116 |
| 115 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { | 117 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { |
| 116 return CacheAccess(const_cast<GrGpuResource*>(this)); | 118 return CacheAccess(const_cast<GrGpuResource*>(this)); |
| 117 } | 119 } |
| 118 | 120 |
| 119 #endif | 121 #endif |
| OLD | NEW |