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