OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 this->setupDrawBuffer(); | 150 this->setupDrawBuffer(); |
151 | 151 |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 int GrContext::GetThreadInstanceCount() { | 155 int GrContext::GetThreadInstanceCount() { |
156 return THREAD_INSTANCE_COUNT; | 156 return THREAD_INSTANCE_COUNT; |
157 } | 157 } |
158 | 158 |
159 GrContext::~GrContext() { | 159 GrContext::~GrContext() { |
160 for (int i = 0; i < fCleanUpData.count(); ++i) { | |
161 (*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo); | |
162 } | |
163 | |
164 if (NULL == fGpu) { | 160 if (NULL == fGpu) { |
165 return; | 161 return; |
166 } | 162 } |
167 | 163 |
168 this->flush(); | 164 this->flush(); |
169 | 165 |
| 166 for (int i = 0; i < fCleanUpData.count(); ++i) { |
| 167 (*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo); |
| 168 } |
| 169 |
170 // Since the gpu can hold scratch textures, give it a chance to let go | 170 // Since the gpu can hold scratch textures, give it a chance to let go |
171 // of them before freeing the texture cache | 171 // of them before freeing the texture cache |
172 fGpu->purgeResources(); | 172 fGpu->purgeResources(); |
173 | 173 |
174 delete fTextureCache; | 174 delete fTextureCache; |
175 fTextureCache = NULL; | 175 fTextureCache = NULL; |
176 delete fFontCache; | 176 delete fFontCache; |
177 delete fDrawBuffer; | 177 delete fDrawBuffer; |
178 delete fDrawBufferVBAllocPool; | 178 delete fDrawBufferVBAllocPool; |
179 delete fDrawBufferIBAllocPool; | 179 delete fDrawBufferIBAllocPool; |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 return NULL; | 1761 return NULL; |
1762 } | 1762 } |
1763 } | 1763 } |
1764 | 1764 |
1765 /////////////////////////////////////////////////////////////////////////////// | 1765 /////////////////////////////////////////////////////////////////////////////// |
1766 #if GR_CACHE_STATS | 1766 #if GR_CACHE_STATS |
1767 void GrContext::printCacheStats() const { | 1767 void GrContext::printCacheStats() const { |
1768 fTextureCache->printStats(); | 1768 fTextureCache->printStats(); |
1769 } | 1769 } |
1770 #endif | 1770 #endif |
OLD | NEW |