| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 int GrContext::GetThreadInstanceCount() { | 134 int GrContext::GetThreadInstanceCount() { |
| 135 return THREAD_INSTANCE_COUNT; | 135 return THREAD_INSTANCE_COUNT; |
| 136 } | 136 } |
| 137 | 137 |
| 138 GrContext::~GrContext() { | 138 GrContext::~GrContext() { |
| 139 for (int i = 0; i < fCleanUpData.count(); ++i) { | 139 for (int i = 0; i < fCleanUpData.count(); ++i) { |
| 140 (*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo); | 140 (*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo); |
| 141 } | 141 } |
| 142 | 142 |
| 143 if (NULL == fGpu) { |
| 144 return; |
| 145 } |
| 146 |
| 143 this->flush(); | 147 this->flush(); |
| 144 | 148 |
| 145 // Since the gpu can hold scratch textures, give it a chance to let go | 149 // Since the gpu can hold scratch textures, give it a chance to let go |
| 146 // of them before freeing the texture cache | 150 // of them before freeing the texture cache |
| 147 fGpu->purgeResources(); | 151 fGpu->purgeResources(); |
| 148 | 152 |
| 149 delete fTextureCache; | 153 delete fTextureCache; |
| 150 fTextureCache = NULL; | 154 fTextureCache = NULL; |
| 151 delete fFontCache; | 155 delete fFontCache; |
| 152 delete fDrawBuffer; | 156 delete fDrawBuffer; |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 return srcTexture; | 1789 return srcTexture; |
| 1786 } | 1790 } |
| 1787 } | 1791 } |
| 1788 | 1792 |
| 1789 /////////////////////////////////////////////////////////////////////////////// | 1793 /////////////////////////////////////////////////////////////////////////////// |
| 1790 #if GR_CACHE_STATS | 1794 #if GR_CACHE_STATS |
| 1791 void GrContext::printCacheStats() const { | 1795 void GrContext::printCacheStats() const { |
| 1792 fTextureCache->printStats(); | 1796 fTextureCache->printStats(); |
| 1793 } | 1797 } |
| 1794 #endif | 1798 #endif |
| OLD | NEW |