| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 4 * | 3 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 #ifndef GrGpuResourceCacheAccess_DEFINED | 8 #ifndef GrGpuResourceCacheAccess_DEFINED |
| 10 #define GrGpuResourceCacheAccess_DEFINED | 9 #define GrGpuResourceCacheAccess_DEFINED |
| 11 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 34 * Is the resource object wrapping an externally allocated GPU resource that
Skia has not taken | 33 * Is the resource object wrapping an externally allocated GPU resource that
Skia has not taken |
| 35 * ownership of. | 34 * ownership of. |
| 36 */ | 35 */ |
| 37 bool isBorrowed() const { return GrGpuResource::kBorrowed_LifeCycle == fReso
urce->fLifeCycle; } | 36 bool isBorrowed() const { return GrGpuResource::kBorrowed_LifeCycle == fReso
urce->fLifeCycle; } |
| 38 | 37 |
| 39 /** | 38 /** |
| 40 * Is the resource object wrapping an externally allocated GPU resource that
Skia has taken | 39 * Is the resource object wrapping an externally allocated GPU resource that
Skia has taken |
| 41 * ownership of. | 40 * ownership of. |
| 42 */ | 41 */ |
| 43 bool isAdopted() const { return GrGpuResource::kAdopted_LifeCycle == fResour
ce->fLifeCycle; } | 42 bool isAdopted() const { return GrGpuResource::kAdopted_LifeCycle == fResour
ce->fLifeCycle; } |
| 44 | 43 |
| 45 /** | 44 /** |
| 46 * Called by the cache to delete the resource under normal circumstances. | 45 * Called by the cache to delete the resource under normal circumstances. |
| 47 */ | 46 */ |
| 48 void release() { | 47 void release() { |
| 49 fResource->release(); | 48 fResource->release(); |
| 50 if (fResource->isPurgeable()) { | 49 if (fResource->isPurgeable()) { |
| 51 delete fResource; | 50 delete fResource; |
| 52 } | 51 } |
| 53 } | 52 } |
| 54 | 53 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing | 87 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } | 90 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } |
| 92 | 91 |
| 93 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { | 92 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { |
| 94 return CacheAccess(const_cast<GrGpuResource*>(this)); | 93 return CacheAccess(const_cast<GrGpuResource*>(this)); |
| 95 } | 94 } |
| 96 | 95 |
| 97 #endif | 96 #endif |
| OLD | NEW |