OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 GrGpuResourcePriv_DEFINED | 9 #ifndef GrGpuResourcePriv_DEFINED |
10 #define GrGpuResourcePriv_DEFINED | 10 #define GrGpuResourcePriv_DEFINED |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 /** | 44 /** |
45 * Does the resource count against the resource budget? | 45 * Does the resource count against the resource budget? |
46 */ | 46 */ |
47 bool isBudgeted() const { | 47 bool isBudgeted() const { |
48 bool ret = GrGpuResource::kCached_LifeCycle == fResource->fLifeCycle; | 48 bool ret = GrGpuResource::kCached_LifeCycle == fResource->fLifeCycle; |
49 SkASSERT(ret || !fResource->getUniqueKey().isValid()); | 49 SkASSERT(ret || !fResource->getUniqueKey().isValid()); |
50 return ret; | 50 return ret; |
51 } | 51 } |
52 | 52 |
| 53 /** |
| 54 * Is the resource object wrapping an externally allocated GPU resource? |
| 55 */ |
| 56 bool isExternal() const { return fResource->isExternal(); } |
| 57 |
53 /** | 58 /** |
54 * If this resource can be used as a scratch resource this returns a valid s
cratch key. | 59 * If this resource can be used as a scratch resource this returns a valid s
cratch key. |
55 * Otherwise it returns a key for which isNullScratch is true. The resource
may currently be | 60 * Otherwise it returns a key for which isNullScratch is true. The resource
may currently be |
56 * used as a uniquely keyed resource rather than scratch. Check isScratch(). | 61 * used as a uniquely keyed resource rather than scratch. Check isScratch(). |
57 */ | 62 */ |
58 const GrScratchKey& getScratchKey() const { return fResource->fScratchKey; } | 63 const GrScratchKey& getScratchKey() const { return fResource->fScratchKey; } |
59 | 64 |
60 /** | 65 /** |
61 * If the resource has a scratch key, the key will be removed. Since scratch
keys are installed | 66 * If the resource has a scratch key, the key will be removed. Since scratch
keys are installed |
62 * at resource creation time, this means the resource will never again be us
ed as scratch. | 67 * at resource creation time, this means the resource will never again be us
ed as scratch. |
(...skipping 14 matching lines...) Expand all Loading... |
77 friend class GrGpuResource; // to construct/copy this type. | 82 friend class GrGpuResource; // to construct/copy this type. |
78 }; | 83 }; |
79 | 84 |
80 inline GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() { return Resour
cePriv(this); } | 85 inline GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() { return Resour
cePriv(this); } |
81 | 86 |
82 inline const GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() const { | 87 inline const GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() const { |
83 return ResourcePriv(const_cast<GrGpuResource*>(this)); | 88 return ResourcePriv(const_cast<GrGpuResource*>(this)); |
84 } | 89 } |
85 | 90 |
86 #endif | 91 #endif |
OLD | NEW |