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 |
11 | 11 |
12 #include "GrGpuResource.h" | 12 #include "GrGpuResource.h" |
13 | 13 |
14 /** | 14 /** |
15 * This class allows code internal to Skia privileged access to manage the cache
keys and budget | 15 * This class allows code internal to Skia privileged access to manage the cache
keys and budget |
16 * status of a GrGpuResource object. | 16 * status of a GrGpuResource object. |
17 */ | 17 */ |
18 class GrGpuResource::ResourcePriv { | 18 class GrGpuResource::ResourcePriv { |
19 public: | 19 public: |
20 /** | 20 /** |
21 * Sets a unique key for the resource. If the resource was previously cached
as scratch it will | 21 * Sets a unique key for the resource. If the resource was previously cached
as scratch it will |
22 * be converted to a uniquely-keyed resource. Currently this may only be cal
led once per | 22 * be converted to a uniquely-keyed resource. If the key is invalid then thi
s is equivalent to |
23 * resource. It fails if there is already a resource with the same unique ke
y. TODO: make this | 23 * removeUniqueKey(). If another resource is using the key then its unique k
ey is removed and |
24 * supplant the resource that currently is using the unique key, allow resou
rces' unique keys | 24 * this resource takes over the key. |
25 * to change, and allow removal of a unique key to convert a resource back t
o scratch. | |
26 */ | 25 */ |
27 bool setUniqueKey(const GrUniqueKey& key) { | 26 void setUniqueKey(const GrUniqueKey& key) { fResource->setUniqueKey(key); } |
28 return fResource->setUniqueKey(key); | |
29 } | |
30 | 27 |
31 /** Removes the unique key from a resource */ | 28 /** Removes the unique key from a resource. If the resource has a scratch ke
y, it may be |
32 void removeUniqueKey() { return fResource->removeUniqueKey(); } | 29 preserved for recycling as scratch. */ |
| 30 void removeUniqueKey() { fResource->removeUniqueKey(); } |
33 | 31 |
34 /** | 32 /** |
35 * If the resource is uncached make it cached. Has no effect on resources th
at are wrapped or | 33 * If the resource is uncached make it cached. Has no effect on resources th
at are wrapped or |
36 * already cached. | 34 * already cached. |
37 */ | 35 */ |
38 void makeBudgeted() { fResource->makeBudgeted(); } | 36 void makeBudgeted() { fResource->makeBudgeted(); } |
39 | 37 |
40 /** | 38 /** |
41 * If the resource is cached make it uncached. Has no effect on resources th
at are wrapped or | 39 * If the resource is cached make it uncached. Has no effect on resources th
at are wrapped or |
42 * already uncached. Furthermore, resources with unique keys cannot be made
unbudgeted. | 40 * already uncached. Furthermore, resources with unique keys cannot be made
unbudgeted. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 friend class GrGpuResource; // to construct/copy this type. | 77 friend class GrGpuResource; // to construct/copy this type. |
80 }; | 78 }; |
81 | 79 |
82 inline GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() { return Resour
cePriv(this); } | 80 inline GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() { return Resour
cePriv(this); } |
83 | 81 |
84 inline const GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() const { | 82 inline const GrGpuResource::ResourcePriv GrGpuResource::resourcePriv() const { |
85 return ResourcePriv(const_cast<GrGpuResource*>(this)); | 83 return ResourcePriv(const_cast<GrGpuResource*>(this)); |
86 } | 84 } |
87 | 85 |
88 #endif | 86 #endif |
OLD | NEW |