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 #include "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
11 #include "effects/GrConfigConversionEffect.h" | 11 #include "effects/GrConfigConversionEffect.h" |
12 #include "effects/GrDashingEffect.h" | 12 #include "effects/GrDashingEffect.h" |
13 #include "effects/GrSingleTextureEffect.h" | 13 #include "effects/GrSingleTextureEffect.h" |
14 | 14 |
15 #include "GrAARectRenderer.h" | 15 #include "GrAARectRenderer.h" |
| 16 #include "GrBitmapTextContext.h" |
16 #include "GrBufferAllocPool.h" | 17 #include "GrBufferAllocPool.h" |
17 #include "GrGpu.h" | 18 #include "GrGpu.h" |
18 #include "GrDistanceFieldTextContext.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" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 244 } |
244 if (resourceBytes) { | 245 if (resourceBytes) { |
245 *resourceBytes = fResourceCache->getCachedResourceBytes(); | 246 *resourceBytes = fResourceCache->getCachedResourceBytes(); |
246 } | 247 } |
247 } | 248 } |
248 | 249 |
249 GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget, | 250 GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget, |
250 const SkDeviceProperties& | 251 const SkDeviceProperties& |
251 leakyProperties, | 252 leakyProperties, |
252 bool enableDistanceFieldFonts) { | 253 bool enableDistanceFieldFonts) { |
253 if (fGpu->caps()->pathRenderingSupport()) { | 254 GrTextContext* mainTextContext; |
254 if (renderTarget->getStencilBuffer() && renderTarget->isMultisampled())
{ | 255 if (fGpu->caps()->pathRenderingSupport() && renderTarget->getStencilBuffer()
&& |
255 return SkNEW_ARGS(GrStencilAndCoverTextContext, (this, leakyProperti
es)); | 256 renderTarget->isMultisampled())
{ |
256 } | 257 mainTextContext = SkNEW_ARGS(GrStencilAndCoverTextContext, (this, leakyP
roperties)); |
| 258 } else { |
| 259 mainTextContext = SkNEW_ARGS(GrDistanceFieldTextContext, (this, leakyPro
perties, |
| 260 enableDistanceFieldFonts)); |
257 } | 261 } |
258 return SkNEW_ARGS(GrDistanceFieldTextContext, (this, leakyProperties, | 262 mainTextContext->setFallbackTextContext( |
259 enableDistanceFieldFonts)); | 263 SkNEW_ARGS(GrBitmapTextContext, (this, l
eakyProperties))); |
| 264 |
| 265 return mainTextContext; |
260 } | 266 } |
261 | 267 |
262 //////////////////////////////////////////////////////////////////////////////// | 268 //////////////////////////////////////////////////////////////////////////////// |
263 | 269 |
264 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, | 270 GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, |
265 const GrCacheID& cacheID, | 271 const GrCacheID& cacheID, |
266 const GrTextureParams* params) { | 272 const GrTextureParams* params) { |
267 GrResourceKey resourceKey = GrTexturePriv::ComputeKey(fGpu, params, desc, ca
cheID); | 273 GrResourceKey resourceKey = GrTexturePriv::ComputeKey(fGpu, params, desc, ca
cheID); |
268 GrGpuResource* resource = fResourceCache->find(resourceKey); | 274 GrGpuResource* resource = fResourceCache->find(resourceKey); |
269 SkSafeRef(resource); | 275 SkSafeRef(resource); |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 fResourceCache->printStats(); | 1868 fResourceCache->printStats(); |
1863 } | 1869 } |
1864 #endif | 1870 #endif |
1865 | 1871 |
1866 #if GR_GPU_STATS | 1872 #if GR_GPU_STATS |
1867 const GrContext::GPUStats* GrContext::gpuStats() const { | 1873 const GrContext::GPUStats* GrContext::gpuStats() const { |
1868 return fGpu->gpuStats(); | 1874 return fGpu->gpuStats(); |
1869 } | 1875 } |
1870 #endif | 1876 #endif |
1871 | 1877 |
OLD | NEW |