| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 * The 'info' parameter will be stored and passed to the callback function. | 86 * The 'info' parameter will be stored and passed to the callback function. |
| 87 */ | 87 */ |
| 88 void addCleanUp(PFCleanUpFunc cleanUp, void* info) { | 88 void addCleanUp(PFCleanUpFunc cleanUp, void* info) { |
| 89 CleanUpData* entry = fCleanUpData.push(); | 89 CleanUpData* entry = fCleanUpData.push(); |
| 90 | 90 |
| 91 entry->fFunc = cleanUp; | 91 entry->fFunc = cleanUp; |
| 92 entry->fInfo = info; | 92 entry->fInfo = info; |
| 93 } | 93 } |
| 94 | 94 |
| 95 /** | 95 /** |
| 96 * Abandons all GPU resources and assumes the underlying backend 3D API | 96 * Abandons all GPU resources and assumes the underlying backend 3D API cont
ext is not longer |
| 97 * context is not longer usable. Call this if you have lost the associated | 97 * usable. Call this if you have lost the associated GPU context, and thus i
nternal texture, |
| 98 * GPU context, and thus internal texture, buffer, etc. references/IDs are | 98 * buffer, etc. references/IDs are now invalid. Calling this ensures that th
e destructors of the |
| 99 * now invalid. Should be called even when GrContext is no longer going to | 99 * GrContext and any of its created resource objects will not make backend 3
D API calls. Content |
| 100 * be used for two reasons: | 100 * rendered but not previously flushed may be lost. After this function is c
alled all subsequent |
| 101 * 1) ~GrContext will not try to free the objects in the 3D API. | 101 * calls on the GrContext will fail or be no-ops. |
| 102 * 2) Any GrGpuResources created by this GrContext that outlive | 102 * |
| 103 * will be marked as invalid (GrGpuResource::wasDestroyed()) and | 103 * The typical use case for this function is that the underlying 3D context
was lost and further |
| 104 * when they're destroyed no 3D API calls will be made. | 104 * API calls may crash. |
| 105 * Content drawn since the last GrContext::flush() may be lost. After this | |
| 106 * function is called the only valid action on the GrContext or | |
| 107 * GrGpuResources it created is to destroy them. | |
| 108 */ | 105 */ |
| 109 void abandonContext(); | 106 void abandonContext(); |
| 110 | 107 |
| 108 /** |
| 109 * This is similar to abandonContext() however the underlying 3D context is
not yet lost and |
| 110 * the GrContext will cleanup all allocated resources before returning. Afte
r returning it will |
| 111 * assume that the underlying context may no longer be valid. |
| 112 * |
| 113 * The typical use case for this function is that the client is going to des
troy the 3D context |
| 114 * but can't guarantee that GrContext will be destroyed first (perhaps becau
se it may be ref'ed |
| 115 * elsewhere by either the client or Skia objects). |
| 116 */ |
| 117 void releaseResourcesAndAbandonContext(); |
| 118 |
| 111 /////////////////////////////////////////////////////////////////////////// | 119 /////////////////////////////////////////////////////////////////////////// |
| 112 // Resource Cache | 120 // Resource Cache |
| 113 | 121 |
| 114 /** | 122 /** |
| 115 * Return the current GPU resource cache limits. | 123 * Return the current GPU resource cache limits. |
| 116 * | 124 * |
| 117 * @param maxResources If non-null, returns maximum number of resources tha
t | 125 * @param maxResources If non-null, returns maximum number of resources tha
t |
| 118 * can be held in the cache. | 126 * can be held in the cache. |
| 119 * @param maxResourceBytes If non-null, returns maximum number of bytes of | 127 * @param maxResourceBytes If non-null, returns maximum number of bytes of |
| 120 * video memory that can be held in the cache. | 128 * video memory that can be held in the cache. |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 SkAutoTUnref<const GrCaps> fCaps; | 478 SkAutoTUnref<const GrCaps> fCaps; |
| 471 uint32_t fContextUniqueID; | 479 uint32_t fContextUniqueID; |
| 472 | 480 |
| 473 friend class GrContext; | 481 friend class GrContext; |
| 474 friend class SkImage; | 482 friend class SkImage; |
| 475 | 483 |
| 476 typedef SkRefCnt INHERITED; | 484 typedef SkRefCnt INHERITED; |
| 477 }; | 485 }; |
| 478 | 486 |
| 479 #endif | 487 #endif |
| OLD | NEW |