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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |