| 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 GrResourceCache2_DEFINED | 9 #ifndef GrResourceCache2_DEFINED |
| 10 #define GrResourceCache2_DEFINED | 10 #define GrResourceCache2_DEFINED |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 static const GrScratchKey& GetKey(const GrGpuResource& r) { | 187 static const GrScratchKey& GetKey(const GrGpuResource& r) { |
| 188 return r.cacheAccess().getScratchKey(); | 188 return r.cacheAccess().getScratchKey(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 static uint32_t Hash(const GrScratchKey& key) { return key.hash(); } | 191 static uint32_t Hash(const GrScratchKey& key) { return key.hash(); } |
| 192 }; | 192 }; |
| 193 typedef SkTMultiMap<GrGpuResource, GrScratchKey, ScratchMapTraits> ScratchMa
p; | 193 typedef SkTMultiMap<GrGpuResource, GrScratchKey, ScratchMapTraits> ScratchMa
p; |
| 194 | 194 |
| 195 struct ContentHashTraits { | 195 struct ContentHashTraits { |
| 196 static const GrContentKey& GetKey(const GrGpuResource& r) { | 196 static const GrContentKey& GetKey(const GrGpuResource& r) { |
| 197 return r.getContentKey(); | 197 return r.cacheAccess().getContentKey(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 static uint32_t Hash(const GrContentKey& key) { return key.hash(); } | 200 static uint32_t Hash(const GrContentKey& key) { return key.hash(); } |
| 201 }; | 201 }; |
| 202 typedef SkTDynamicHash<GrGpuResource, GrContentKey, ContentHashTraits> Conte
ntHash; | 202 typedef SkTDynamicHash<GrGpuResource, GrContentKey, ContentHashTraits> Conte
ntHash; |
| 203 | 203 |
| 204 typedef SkTInternalLList<GrGpuResource> ResourceList; | 204 typedef SkTInternalLList<GrGpuResource> ResourceList; |
| 205 | 205 |
| 206 ResourceList fResources; | 206 ResourceList fResources; |
| 207 // This map holds all resources that can be used as scratch resources. | 207 // This map holds all resources that can be used as scratch resources. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 friend class GrGpuResource; // To access all the proxy inline methods. | 296 friend class GrGpuResource; // To access all the proxy inline methods. |
| 297 friend class GrResourceCache2; // To create this type. | 297 friend class GrResourceCache2; // To create this type. |
| 298 }; | 298 }; |
| 299 | 299 |
| 300 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() { | 300 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() { |
| 301 return ResourceAccess(this); | 301 return ResourceAccess(this); |
| 302 } | 302 } |
| 303 | 303 |
| 304 #endif | 304 #endif |
| OLD | NEW |