| 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" |
| 11 | 11 |
| 12 #include "effects/GrSingleTextureEffect.h" | 12 #include "effects/GrSingleTextureEffect.h" |
| 13 #include "effects/GrConfigConversionEffect.h" | 13 #include "effects/GrConfigConversionEffect.h" |
| 14 | 14 |
| 15 #include "GrAARectRenderer.h" | 15 #include "GrAARectRenderer.h" |
| 16 #include "GrBufferAllocPool.h" | 16 #include "GrBufferAllocPool.h" |
| 17 #include "GrGpu.h" | 17 #include "GrGpu.h" |
| 18 #include "GrDistanceFieldTextContext.h" |
| 18 #include "GrDrawTargetCaps.h" | 19 #include "GrDrawTargetCaps.h" |
| 19 #include "GrIndexBuffer.h" | 20 #include "GrIndexBuffer.h" |
| 20 #include "GrInOrderDrawBuffer.h" | 21 #include "GrInOrderDrawBuffer.h" |
| 21 #include "GrLayerCache.h" | 22 #include "GrLayerCache.h" |
| 22 #include "GrOvalRenderer.h" | 23 #include "GrOvalRenderer.h" |
| 23 #include "GrPathRenderer.h" | 24 #include "GrPathRenderer.h" |
| 24 #include "GrPathUtils.h" | 25 #include "GrPathUtils.h" |
| 25 #include "GrResourceCache.h" | 26 #include "GrResourceCache.h" |
| 26 #include "GrSoftwarePathRenderer.h" | 27 #include "GrSoftwarePathRenderer.h" |
| 27 #include "GrStencilBuffer.h" | 28 #include "GrStencilBuffer.h" |
| 29 #include "GrStencilAndCoverTextContext.h" |
| 28 #include "GrTextStrike.h" | 30 #include "GrTextStrike.h" |
| 29 #include "GrTracing.h" | 31 #include "GrTracing.h" |
| 30 #include "SkGr.h" | 32 #include "SkGr.h" |
| 31 #include "SkRTConf.h" | 33 #include "SkRTConf.h" |
| 32 #include "SkRRect.h" | 34 #include "SkRRect.h" |
| 33 #include "SkStrokeRec.h" | 35 #include "SkStrokeRec.h" |
| 34 #include "SkTLazy.h" | 36 #include "SkTLazy.h" |
| 35 #include "SkTLS.h" | 37 #include "SkTLS.h" |
| 36 #include "SkTraceEvent.h" | 38 #include "SkTraceEvent.h" |
| 37 | 39 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 227 |
| 226 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { | 228 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { |
| 227 if (NULL != resourceCount) { | 229 if (NULL != resourceCount) { |
| 228 *resourceCount = fResourceCache->getCachedResourceCount(); | 230 *resourceCount = fResourceCache->getCachedResourceCount(); |
| 229 } | 231 } |
| 230 if (NULL != resourceBytes) { | 232 if (NULL != resourceBytes) { |
| 231 *resourceBytes = fResourceCache->getCachedResourceBytes(); | 233 *resourceBytes = fResourceCache->getCachedResourceBytes(); |
| 232 } | 234 } |
| 233 } | 235 } |
| 234 | 236 |
| 237 GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget, |
| 238 const SkDeviceProperties& |
| 239 leakyProperties, |
| 240 bool enableDistanceFieldFonts) { |
| 241 if (fGpu->caps()->pathRenderingSupport()) { |
| 242 if (renderTarget->getStencilBuffer() && renderTarget->isMultisampled())
{ |
| 243 return SkNEW_ARGS(GrStencilAndCoverTextContext, (this, leakyProperti
es)); |
| 244 } |
| 245 } |
| 246 return SkNEW_ARGS(GrDistanceFieldTextContext, (this, leakyProperties, |
| 247 enableDistanceFieldFonts)); |
| 248 } |
| 249 |
| 235 //////////////////////////////////////////////////////////////////////////////// | 250 //////////////////////////////////////////////////////////////////////////////// |
| 236 | 251 |
| 237 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, | 252 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, |
| 238 const GrCacheID& cacheID, | 253 const GrCacheID& cacheID, |
| 239 const GrTextureParams* params) { | 254 const GrTextureParams* params) { |
| 240 GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca
cheID); | 255 GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca
cheID); |
| 241 GrCacheable* resource = fResourceCache->find(resourceKey); | 256 GrCacheable* resource = fResourceCache->find(resourceKey); |
| 242 SkSafeRef(resource); | 257 SkSafeRef(resource); |
| 243 return static_cast<GrTexture*>(resource); | 258 return static_cast<GrTexture*>(resource); |
| 244 } | 259 } |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 SkSafeRef(resource); | 1853 SkSafeRef(resource); |
| 1839 return resource; | 1854 return resource; |
| 1840 } | 1855 } |
| 1841 | 1856 |
| 1842 /////////////////////////////////////////////////////////////////////////////// | 1857 /////////////////////////////////////////////////////////////////////////////// |
| 1843 #if GR_CACHE_STATS | 1858 #if GR_CACHE_STATS |
| 1844 void GrContext::printCacheStats() const { | 1859 void GrContext::printCacheStats() const { |
| 1845 fResourceCache->printStats(); | 1860 fResourceCache->printStats(); |
| 1846 } | 1861 } |
| 1847 #endif | 1862 #endif |
| OLD | NEW |