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 15 matching lines...) Expand all Loading... |
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 fResource->resourcePriv().isBudgeted(); | 30 fResource->resourcePriv().isBudgeted(); |
31 } | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * Is the resource object wrapping an externally allocated GPU resource? | 34 * Is the resource object wrapping an externally allocated GPU resource? |
35 */ | 35 */ |
36 bool isWrapped() const { return GrGpuResource::kWrapped_LifeCycle == fResour
ce->fLifeCycle; } | 36 bool isExternal() const { return fResource->isExternal(); } |
| 37 |
| 38 /** |
| 39 * Is the resource object wrapping an externally allocated GPU resource that
Skia has not taken |
| 40 * ownership of. |
| 41 */ |
| 42 bool isBorrowed() const { return GrGpuResource::kBorrowed_LifeCycle == fReso
urce->fLifeCycle; } |
| 43 |
| 44 /** |
| 45 * Is the resource object wrapping an externally allocated GPU resource that
Skia has taken |
| 46 * ownership of. |
| 47 */ |
| 48 bool isAdopted() const { return GrGpuResource::kAdopted_LifeCycle == fResour
ce->fLifeCycle; } |
37 | 49 |
38 /** | 50 /** |
39 * Called by the cache to delete the resource under normal circumstances. | 51 * Called by the cache to delete the resource under normal circumstances. |
40 */ | 52 */ |
41 void release() { | 53 void release() { |
42 fResource->release(); | 54 fResource->release(); |
43 if (fResource->isPurgeable()) { | 55 if (fResource->isPurgeable()) { |
44 SkDELETE(fResource); | 56 SkDELETE(fResource); |
45 } | 57 } |
46 } | 58 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing | 93 friend void test_unbudgeted_to_scratch(skiatest::Reporter* reporter); // for
unit testing |
82 }; | 94 }; |
83 | 95 |
84 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } | 96 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc
ess(this); } |
85 | 97 |
86 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { | 98 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { |
87 return CacheAccess(const_cast<GrGpuResource*>(this)); | 99 return CacheAccess(const_cast<GrGpuResource*>(this)); |
88 } | 100 } |
89 | 101 |
90 #endif | 102 #endif |
OLD | NEW |