OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * 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 |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 */ | 162 */ |
163 void purgeCache(); | 163 void purgeCache(); |
164 | 164 |
165 /** | 165 /** |
166 * Purge all the unlocked resources from the cache. | 166 * Purge all the unlocked resources from the cache. |
167 * This entry point is mainly meant for timing texture uploads | 167 * This entry point is mainly meant for timing texture uploads |
168 * and is not defined in normal builds of Skia. | 168 * and is not defined in normal builds of Skia. |
169 */ | 169 */ |
170 void purgeAllUnlockedResources(); | 170 void purgeAllUnlockedResources(); |
171 | 171 |
172 /** Sets a unique key on the resource. The resource must not already have a
unique key and the | 172 /** |
173 * key must not already be in use for this to succeed. | 173 * Sets a unique key on the resource. Upon key collision this resource takes
the place of the |
| 174 * previous resource that had the key. |
174 */ | 175 */ |
175 bool addResourceToCache(const GrUniqueKey&, GrGpuResource*); | 176 void addResourceToCache(const GrUniqueKey&, GrGpuResource*); |
176 | 177 |
177 /** | 178 /** |
178 * Finds a resource in the cache, based on the specified key. This is intend
ed for use in | 179 * Finds a resource in the cache, based on the specified key. This is intend
ed for use in |
179 * conjunction with addResourceToCache(). The return value will be NULL if n
ot found. The | 180 * conjunction with addResourceToCache(). The return value will be NULL if n
ot found. The |
180 * caller must balance with a call to unref(). | 181 * caller must balance with a call to unref(). |
181 */ | 182 */ |
182 GrGpuResource* findAndRefCachedResource(const GrUniqueKey&); | 183 GrGpuResource* findAndRefCachedResource(const GrUniqueKey&); |
183 | 184 |
184 /** Helper for casting resource to a texture. Caller must be sure that the r
esource cached | 185 /** Helper for casting resource to a texture. Caller must be sure that the r
esource cached |
185 with the key is either NULL or a texture and not another resource type.
*/ | 186 with the key is either NULL or a texture and not another resource type.
*/ |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 /** | 828 /** |
828 * This callback allows the resource cache to callback into the GrContext | 829 * This callback allows the resource cache to callback into the GrContext |
829 * when the cache is still over budget after a purge. | 830 * when the cache is still over budget after a purge. |
830 */ | 831 */ |
831 static void OverBudgetCB(void* data); | 832 static void OverBudgetCB(void* data); |
832 | 833 |
833 typedef SkRefCnt INHERITED; | 834 typedef SkRefCnt INHERITED; |
834 }; | 835 }; |
835 | 836 |
836 #endif | 837 #endif |
OLD | NEW |