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

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

Issue 26557003: Add a GPU paths to resource cache of the context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 1 month 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') | src/gpu/GrPath.h » ('j') | 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 delete fDrawBufferVBAllocPool; 210 delete fDrawBufferVBAllocPool;
211 fDrawBufferVBAllocPool = NULL; 211 fDrawBufferVBAllocPool = NULL;
212 212
213 delete fDrawBufferIBAllocPool; 213 delete fDrawBufferIBAllocPool;
214 fDrawBufferIBAllocPool = NULL; 214 fDrawBufferIBAllocPool = NULL;
215 215
216 fAARectRenderer->reset(); 216 fAARectRenderer->reset();
217 fOvalRenderer->reset(); 217 fOvalRenderer->reset();
218 218
219 fTextureCache->purgeAllUnlocked(); 219 fTextureCache->purgeAllUnlocked();
220
220 fFontCache->freeAll(); 221 fFontCache->freeAll();
221 fGpu->markContextDirty(); 222 fGpu->markContextDirty();
222 } 223 }
223 224
224 void GrContext::resetContext(uint32_t state) { 225 void GrContext::resetContext(uint32_t state) {
225 fGpu->markContextDirty(state); 226 fGpu->markContextDirty(state);
226 } 227 }
227 228
228 void GrContext::freeGpuResources() { 229 void GrContext::freeGpuResources() {
229 this->flush(); 230 this->flush();
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 } 1806 }
1806 GrConfigConversionEffect::PMConversion upmToPM = 1807 GrConfigConversionEffect::PMConversion upmToPM =
1807 static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion); 1808 static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion);
1808 if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) { 1809 if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) {
1809 return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, mat rix); 1810 return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, mat rix);
1810 } else { 1811 } else {
1811 return NULL; 1812 return NULL;
1812 } 1813 }
1813 } 1814 }
1814 1815
1816 GrPath* GrContext::createPath(const SkPath& inPath, const SkStrokeRec& stroke) {
1817 SkASSERT(fGpu->caps()->pathRenderingSupport());
1818
1819 // TODO: now we add to fTextureCache. This should change to fResourceCache.
1820 GrResourceKey resourceKey = GrPath::ComputeKey(inPath, stroke);
1821 GrPath* path = static_cast<GrPath*>(fTextureCache->find(resourceKey));
1822 if (NULL != path && path->isEqualTo(inPath, stroke)) {
1823 path->ref();
1824 } else {
1825 path = fGpu->createPath(inPath, stroke);
1826 fTextureCache->purgeAsNeeded(1, path->sizeInBytes());
1827 fTextureCache->addResource(resourceKey, path);
1828 }
1829 return path;
1830 }
1831
1815 /////////////////////////////////////////////////////////////////////////////// 1832 ///////////////////////////////////////////////////////////////////////////////
1816 #if GR_CACHE_STATS 1833 #if GR_CACHE_STATS
1817 void GrContext::printCacheStats() const { 1834 void GrContext::printCacheStats() const {
1818 fTextureCache->printStats(); 1835 fTextureCache->printStats();
1819 } 1836 }
1820 #endif 1837 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698