| 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 13 matching lines...) Expand all Loading... |
| 24 /** | 24 /** |
| 25 * Is the resource currently cached as scratch? This means it is cached, has
a valid scratch | 25 * Is the resource currently cached as scratch? This means it is cached, has
a valid scratch |
| 26 * key, and does not have a unique key. | 26 * key, and does not have a unique key. |
| 27 */ | 27 */ |
| 28 bool isScratch() const { | 28 bool isScratch() const { |
| 29 return !fResource->getUniqueKey().isValid() && fResource->fScratchKey.is
Valid() && | 29 return !fResource->getUniqueKey().isValid() && fResource->fScratchKey.is
Valid() && |
| 30 SkBudgeted::kYes == fResource->resourcePriv().isBudgeted(); | 30 SkBudgeted::kYes == fResource->resourcePriv().isBudgeted(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Is the resource object wrapping an externally allocated GPU resource that
Skia has not taken | |
| 35 * ownership of. | |
| 36 */ | |
| 37 bool isBorrowed() const { return GrGpuResource::kBorrowed_LifeCycle == fReso
urce->fLifeCycle; } | |
| 38 | |
| 39 /** | |
| 40 * Is the resource object wrapping an externally allocated GPU resource that
Skia has taken | |
| 41 * ownership of. | |
| 42 */ | |
| 43 bool isAdopted() const { return GrGpuResource::kAdopted_LifeCycle == fResour
ce->fLifeCycle; } | |
| 44 | |
| 45 /** | |
| 46 * Called by the cache to delete the resource under normal circumstances. | 34 * Called by the cache to delete the resource under normal circumstances. |
| 47 */ | 35 */ |
| 48 void release() { | 36 void release() { |
| 49 fResource->release(); | 37 fResource->release(); |
| 50 if (fResource->isPurgeable()) { | 38 if (fResource->isPurgeable()) { |
| 51 delete fResource; | 39 delete fResource; |
| 52 } | 40 } |
| 53 } | 41 } |
| 54 | 42 |
| 55 /** | 43 /** |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing | 76 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing |
| 89 }; | 77 }; |
| 90 | 78 |
| 91 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } | 79 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } |
| 92 | 80 |
| 93 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { | 81 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { |
| 94 return CacheAccess(const_cast<GrGpuResource*>(this)); | 82 return CacheAccess(const_cast<GrGpuResource*>(this)); |
| 95 } | 83 } |
| 96 | 84 |
| 97 #endif | 85 #endif |
| OLD | NEW |