Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: src/gpu/GrContext.cpp

Issue 261593009: Allow custom resources in the GrContext's cache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebaes Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698