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/GrConfigConversionEffect.h" | 12 #include "effects/GrConfigConversionEffect.h" |
13 #include "effects/GrDashingEffect.h" | 13 #include "effects/GrDashingEffect.h" |
14 #include "effects/GrSingleTextureEffect.h" | 14 #include "effects/GrSingleTextureEffect.h" |
15 | 15 |
16 #include "GrAARectRenderer.h" | 16 #include "GrAARectRenderer.h" |
17 #include "GrBufferAllocPool.h" | 17 #include "GrBufferAllocPool.h" |
18 #include "GrGpu.h" | 18 #include "GrGpu.h" |
| 19 #include "GrDistanceFieldTextContext.h" |
19 #include "GrDrawTargetCaps.h" | 20 #include "GrDrawTargetCaps.h" |
20 #include "GrIndexBuffer.h" | 21 #include "GrIndexBuffer.h" |
21 #include "GrInOrderDrawBuffer.h" | 22 #include "GrInOrderDrawBuffer.h" |
22 #include "GrLayerCache.h" | 23 #include "GrLayerCache.h" |
23 #include "GrOvalRenderer.h" | 24 #include "GrOvalRenderer.h" |
24 #include "GrPathRenderer.h" | 25 #include "GrPathRenderer.h" |
25 #include "GrPathUtils.h" | 26 #include "GrPathUtils.h" |
26 #include "GrResourceCache.h" | 27 #include "GrResourceCache.h" |
27 #include "GrSoftwarePathRenderer.h" | 28 #include "GrSoftwarePathRenderer.h" |
28 #include "GrStencilBuffer.h" | 29 #include "GrStencilBuffer.h" |
| 30 #include "GrStencilAndCoverTextContext.h" |
29 #include "GrStrokeInfo.h" | 31 #include "GrStrokeInfo.h" |
30 #include "GrTextStrike.h" | 32 #include "GrTextStrike.h" |
31 #include "GrTraceMarker.h" | 33 #include "GrTraceMarker.h" |
32 #include "GrTracing.h" | 34 #include "GrTracing.h" |
33 #include "SkDashPathPriv.h" | 35 #include "SkDashPathPriv.h" |
34 #include "SkGr.h" | 36 #include "SkGr.h" |
35 #include "SkRTConf.h" | 37 #include "SkRTConf.h" |
36 #include "SkRRect.h" | 38 #include "SkRRect.h" |
37 #include "SkStrokeRec.h" | 39 #include "SkStrokeRec.h" |
38 #include "SkTLazy.h" | 40 #include "SkTLazy.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 231 |
230 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { | 232 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { |
231 if (NULL != resourceCount) { | 233 if (NULL != resourceCount) { |
232 *resourceCount = fResourceCache->getCachedResourceCount(); | 234 *resourceCount = fResourceCache->getCachedResourceCount(); |
233 } | 235 } |
234 if (NULL != resourceBytes) { | 236 if (NULL != resourceBytes) { |
235 *resourceBytes = fResourceCache->getCachedResourceBytes(); | 237 *resourceBytes = fResourceCache->getCachedResourceBytes(); |
236 } | 238 } |
237 } | 239 } |
238 | 240 |
| 241 GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget, |
| 242 const SkDeviceProperties& |
| 243 leakyProperties, |
| 244 bool enableDistanceFieldFonts) { |
| 245 if (fGpu->caps()->pathRenderingSupport()) { |
| 246 if (renderTarget->getStencilBuffer() && renderTarget->isMultisampled())
{ |
| 247 return SkNEW_ARGS(GrStencilAndCoverTextContext, (this, leakyProperti
es)); |
| 248 } |
| 249 } |
| 250 return SkNEW_ARGS(GrDistanceFieldTextContext, (this, leakyProperties, |
| 251 enableDistanceFieldFonts)); |
| 252 } |
| 253 |
239 //////////////////////////////////////////////////////////////////////////////// | 254 //////////////////////////////////////////////////////////////////////////////// |
240 | 255 |
241 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, | 256 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, |
242 const GrCacheID& cacheID, | 257 const GrCacheID& cacheID, |
243 const GrTextureParams* params) { | 258 const GrTextureParams* params) { |
244 GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca
cheID); | 259 GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca
cheID); |
245 GrCacheable* resource = fResourceCache->find(resourceKey); | 260 GrCacheable* resource = fResourceCache->find(resourceKey); |
246 SkSafeRef(resource); | 261 SkSafeRef(resource); |
247 return static_cast<GrTexture*>(resource); | 262 return static_cast<GrTexture*>(resource); |
248 } | 263 } |
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 fDrawBuffer->removeGpuTraceMarker(marker); | 1933 fDrawBuffer->removeGpuTraceMarker(marker); |
1919 } | 1934 } |
1920 } | 1935 } |
1921 | 1936 |
1922 /////////////////////////////////////////////////////////////////////////////// | 1937 /////////////////////////////////////////////////////////////////////////////// |
1923 #if GR_CACHE_STATS | 1938 #if GR_CACHE_STATS |
1924 void GrContext::printCacheStats() const { | 1939 void GrContext::printCacheStats() const { |
1925 fResourceCache->printStats(); | 1940 fResourceCache->printStats(); |
1926 } | 1941 } |
1927 #endif | 1942 #endif |
OLD | NEW |