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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 entry->fFunc = cleanUp; | 83 entry->fFunc = cleanUp; |
84 entry->fInfo = info; | 84 entry->fInfo = info; |
85 } | 85 } |
86 | 86 |
87 /** | 87 /** |
88 * Abandons all GPU resources, assumes 3D API state is unknown. Call this | 88 * Abandons all GPU resources, assumes 3D API state is unknown. Call this |
89 * if you have lost the associated GPU context, and thus internal texture, | 89 * if you have lost the associated GPU context, and thus internal texture, |
90 * buffer, etc. references/IDs are now invalid. Should be called even when | 90 * buffer, etc. references/IDs are now invalid. Should be called even when |
91 * GrContext is no longer going to be used for two reasons: | 91 * GrContext is no longer going to be used for two reasons: |
92 * 1) ~GrContext will not try to free the objects in the 3D API. | 92 * 1) ~GrContext will not try to free the objects in the 3D API. |
93 * 2) If you've created GrGpuObjects that outlive the GrContext they will | 93 * 2) If you've created GrGpuResources that outlive the GrContext they |
94 * be marked as invalid (GrGpuObjects::isValid()) and won't attempt to | 94 * will be marked as invalid (GrGpuResource::isValid()) and won't |
95 * free their underlying resource in the 3D API. | 95 * attempt to free their underlying resource in the 3D API. |
96 * Content drawn since the last GrContext::flush() may be lost. | 96 * Content drawn since the last GrContext::flush() may be lost. |
97 */ | 97 */ |
98 void contextLost(); | 98 void contextLost(); |
99 | 99 |
100 /** | 100 /** |
101 * Similar to contextLost, but makes no attempt to reset state. | 101 * Similar to contextLost, but makes no attempt to reset state. |
102 * Use this method when GrContext destruction is pending, but | 102 * Use this method when GrContext destruction is pending, but |
103 * the graphics context is destroyed first. | 103 * the graphics context is destroyed first. |
104 */ | 104 */ |
105 void contextDestroyed(); | 105 void contextDestroyed(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 /** | 178 /** |
179 * Purge all the unlocked resources from the cache. | 179 * Purge all the unlocked resources from the cache. |
180 * This entry point is mainly meant for timing texture uploads | 180 * This entry point is mainly meant for timing texture uploads |
181 * and is not defined in normal builds of Skia. | 181 * and is not defined in normal builds of Skia. |
182 */ | 182 */ |
183 void purgeAllUnlockedResources(); | 183 void purgeAllUnlockedResources(); |
184 | 184 |
185 /** | 185 /** |
186 * Stores a custom resource in the cache, based on the specified key. | 186 * Stores a custom resource in the cache, based on the specified key. |
187 */ | 187 */ |
188 void addResourceToCache(const GrResourceKey&, GrGpuObject*); | 188 void addResourceToCache(const GrResourceKey&, GrGpuResource*); |
189 | 189 |
190 /** | 190 /** |
191 * Finds a resource in the cache, based on the specified key. This is intend
ed for use in | 191 * Finds a resource in the cache, based on the specified key. This is intend
ed for use in |
192 * conjunction with addResourceToCache(). The return value will be NULL if n
ot found. The | 192 * conjunction with addResourceToCache(). The return value will be NULL if n
ot found. The |
193 * caller must balance with a call to unref(). | 193 * caller must balance with a call to unref(). |
194 */ | 194 */ |
195 GrGpuObject* findAndRefCachedResource(const GrResourceKey&); | 195 GrGpuResource* findAndRefCachedResource(const GrResourceKey&); |
196 | 196 |
197 /** | 197 /** |
198 * Creates a new text rendering context that is optimal for the | 198 * Creates a new text rendering context that is optimal for the |
199 * render target and the context. Caller assumes the ownership | 199 * render target and the context. Caller assumes the ownership |
200 * of the returned object. The returned object must be deleted | 200 * of the returned object. The returned object must be deleted |
201 * before the context is destroyed. | 201 * before the context is destroyed. |
202 */ | 202 */ |
203 GrTextContext* createTextContext(GrRenderTarget*, | 203 GrTextContext* createTextContext(GrRenderTarget*, |
204 const SkDeviceProperties&, | 204 const SkDeviceProperties&, |
205 bool enableDistanceFieldFonts); | 205 bool enableDistanceFieldFonts); |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 } | 1144 } |
1145 | 1145 |
1146 GrTexture* texture() { return fTexture; } | 1146 GrTexture* texture() { return fTexture; } |
1147 | 1147 |
1148 private: | 1148 private: |
1149 GrContext* fContext; | 1149 GrContext* fContext; |
1150 GrTexture* fTexture; | 1150 GrTexture* fTexture; |
1151 }; | 1151 }; |
1152 | 1152 |
1153 #endif | 1153 #endif |
OLD | NEW |