| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * Return the current GPU resource cache limits. | 117 * Return the current GPU resource cache limits. |
| 118 * | 118 * |
| 119 * @param maxResources If non-null, returns maximum number of resources tha
t | 119 * @param maxResources If non-null, returns maximum number of resources tha
t |
| 120 * can be held in the cache. | 120 * can be held in the cache. |
| 121 * @param maxResourceBytes If non-null, returns maximum number of bytes of | 121 * @param maxResourceBytes If non-null, returns maximum number of bytes of |
| 122 * video memory that can be held in the cache. | 122 * video memory that can be held in the cache. |
| 123 */ | 123 */ |
| 124 void getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) con
st; | 124 void getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) con
st; |
| 125 SK_ATTR_DEPRECATED("This function has been renamed to getResourceCacheLimits
().") | |
| 126 void getTextureCacheLimits(int* maxTextures, size_t* maxTextureBytes) const
{ | |
| 127 this->getResourceCacheLimits(maxTextures, maxTextureBytes); | |
| 128 } | |
| 129 | 125 |
| 130 /** | 126 /** |
| 131 * Gets the current GPU resource cache usage. | 127 * Gets the current GPU resource cache usage. |
| 132 * | 128 * |
| 133 * @param resourceCount If non-null, returns the number of resources that a
re held in the | 129 * @param resourceCount If non-null, returns the number of resources that a
re held in the |
| 134 * cache. | 130 * cache. |
| 135 * @param maxResourceBytes If non-null, returns the total number of bytes o
f video memory held | 131 * @param maxResourceBytes If non-null, returns the total number of bytes o
f video memory held |
| 136 * in the cache. | 132 * in the cache. |
| 137 */ | 133 */ |
| 138 void getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const; | 134 void getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const; |
| 139 | 135 |
| 140 SK_ATTR_DEPRECATED("Use getResourceCacheUsage().") | |
| 141 size_t getGpuTextureCacheBytes() const { | |
| 142 size_t bytes; | |
| 143 this->getResourceCacheUsage(NULL, &bytes); | |
| 144 return bytes; | |
| 145 } | |
| 146 | |
| 147 SK_ATTR_DEPRECATED("Use getResourceCacheUsage().") | |
| 148 int getGpuTextureCacheResourceCount() const { | |
| 149 int count; | |
| 150 this->getResourceCacheUsage(&count, NULL); | |
| 151 return count; | |
| 152 } | |
| 153 | |
| 154 /** | 136 /** |
| 155 * Specify the GPU resource cache limits. If the current cache exceeds eith
er | 137 * Specify the GPU resource cache limits. If the current cache exceeds eith
er |
| 156 * of these, it will be purged (LRU) to keep the cache within these limits. | 138 * of these, it will be purged (LRU) to keep the cache within these limits. |
| 157 * | 139 * |
| 158 * @param maxResources The maximum number of resources that can be held in | 140 * @param maxResources The maximum number of resources that can be held in |
| 159 * the cache. | 141 * the cache. |
| 160 * @param maxResourceBytes The maximum number of bytes of video memory | 142 * @param maxResourceBytes The maximum number of bytes of video memory |
| 161 * that can be held in the cache. | 143 * that can be held in the cache. |
| 162 */ | 144 */ |
| 163 void setResourceCacheLimits(int maxResources, size_t maxResourceBytes); | 145 void setResourceCacheLimits(int maxResources, size_t maxResourceBytes); |
| 164 SK_ATTR_DEPRECATED("This function has been renamed to setResourceCacheLimits
().") | |
| 165 void setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) { | |
| 166 this->setResourceCacheLimits(maxTextures, maxTextureBytes); | |
| 167 } | |
| 168 | 146 |
| 169 /** | 147 /** |
| 170 * Frees GPU created by the context. Can be called to reduce GPU memory | 148 * Frees GPU created by the context. Can be called to reduce GPU memory |
| 171 * pressure. | 149 * pressure. |
| 172 */ | 150 */ |
| 173 void freeGpuResources(); | 151 void freeGpuResources(); |
| 174 | 152 |
| 175 /** | 153 /** |
| 176 * This method should be called whenever a GrResource is unreffed or | 154 * This method should be called whenever a GrResource is unreffed or |
| 177 * switched from exclusive to non-exclusive. This | 155 * switched from exclusive to non-exclusive. This |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 /** | 1020 /** |
| 1043 * This callback allows the resource cache to callback into the GrContext | 1021 * This callback allows the resource cache to callback into the GrContext |
| 1044 * when the cache is still overbudget after a purge. | 1022 * when the cache is still overbudget after a purge. |
| 1045 */ | 1023 */ |
| 1046 static bool OverbudgetCB(void* data); | 1024 static bool OverbudgetCB(void* data); |
| 1047 | 1025 |
| 1048 typedef SkRefCnt INHERITED; | 1026 typedef SkRefCnt INHERITED; |
| 1049 }; | 1027 }; |
| 1050 | 1028 |
| 1051 #endif | 1029 #endif |
| OLD | NEW |