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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 if (NULL == texture) { | 481 if (NULL == texture) { |
482 return; | 482 return; |
483 } | 483 } |
484 | 484 |
485 // This texture should already have a cache entry since it was once | 485 // This texture should already have a cache entry since it was once |
486 // attached | 486 // attached |
487 GrAssert(NULL != texture->getCacheEntry()); | 487 GrAssert(NULL != texture->getCacheEntry()); |
488 | 488 |
489 // Conceptually, the cache entry is going to assume responsibility | 489 // Conceptually, the cache entry is going to assume responsibility |
490 // for the creation ref. | 490 // for the creation ref. |
491 GrAssert(1 == texture->getRefCnt()); | 491 GrAssert(texture->unique()); |
492 | 492 |
493 // Since this texture came from an AutoScratchTexture it should | 493 // Since this texture came from an AutoScratchTexture it should |
494 // still be in the exclusive pile | 494 // still be in the exclusive pile |
495 fTextureCache->makeNonExclusive(texture->getCacheEntry()); | 495 fTextureCache->makeNonExclusive(texture->getCacheEntry()); |
496 | 496 |
497 if (fGpu->caps()->reuseScratchTextures()) { | 497 if (fGpu->caps()->reuseScratchTextures()) { |
498 this->purgeCache(); | 498 this->purgeCache(); |
499 } else { | 499 } else { |
500 // When we aren't reusing textures we know this scratch texture | 500 // When we aren't reusing textures we know this scratch texture |
501 // will never be reused and would be just wasting time in the cache | 501 // will never be reused and would be just wasting time in the cache |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 return NULL; | 1703 return NULL; |
1704 } | 1704 } |
1705 } | 1705 } |
1706 | 1706 |
1707 /////////////////////////////////////////////////////////////////////////////// | 1707 /////////////////////////////////////////////////////////////////////////////// |
1708 #if GR_CACHE_STATS | 1708 #if GR_CACHE_STATS |
1709 void GrContext::printCacheStats() const { | 1709 void GrContext::printCacheStats() const { |
1710 fTextureCache->printStats(); | 1710 fTextureCache->printStats(); |
1711 } | 1711 } |
1712 #endif | 1712 #endif |
OLD | NEW |