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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 if (NULL != path && path->isEqualTo(inPath, stroke)) { | 1818 if (NULL != path && path->isEqualTo(inPath, stroke)) { |
1819 path->ref(); | 1819 path->ref(); |
1820 } else { | 1820 } else { |
1821 path = fGpu->createPath(inPath, stroke); | 1821 path = fGpu->createPath(inPath, stroke); |
1822 fTextureCache->purgeAsNeeded(1, path->gpuMemorySize()); | 1822 fTextureCache->purgeAsNeeded(1, path->gpuMemorySize()); |
1823 fTextureCache->addResource(resourceKey, path); | 1823 fTextureCache->addResource(resourceKey, path); |
1824 } | 1824 } |
1825 return path; | 1825 return path; |
1826 } | 1826 } |
1827 | 1827 |
| 1828 void GrContext::addResourceToCache(const GrResourceKey& resourceKey, GrCacheable
* resource) { |
| 1829 fTextureCache->purgeAsNeeded(1, resource->gpuMemorySize()); |
| 1830 fTextureCache->addResource(resourceKey, resource); |
| 1831 } |
| 1832 |
| 1833 GrCacheable* GrContext::findAndRefCachedResource(const GrResourceKey& resourceKe
y) { |
| 1834 GrCacheable* resource = fTextureCache->find(resourceKey); |
| 1835 SkSafeRef(resource); |
| 1836 return resource; |
| 1837 } |
| 1838 |
1828 /////////////////////////////////////////////////////////////////////////////// | 1839 /////////////////////////////////////////////////////////////////////////////// |
1829 #if GR_CACHE_STATS | 1840 #if GR_CACHE_STATS |
1830 void GrContext::printCacheStats() const { | 1841 void GrContext::printCacheStats() const { |
1831 fTextureCache->printStats(); | 1842 fTextureCache->printStats(); |
1832 } | 1843 } |
1833 #endif | 1844 #endif |
OLD | NEW |