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 "GrAARectRenderer.h" | 11 #include "GrAARectRenderer.h" |
12 #include "GrBufferAllocPool.h" | 12 #include "GrBufferAllocPool.h" |
13 #include "GrDefaultGeoProcFactory.h" | 13 #include "GrDefaultGeoProcFactory.h" |
14 #include "GrGpuResource.h" | 14 #include "GrGpuResource.h" |
15 #include "GrGpuResourceCacheAccess.h" | 15 #include "GrGpuResourceCacheAccess.h" |
16 #include "GrDistanceFieldTextContext.h" | 16 #include "GrDistanceFieldTextContext.h" |
17 #include "GrDrawTargetCaps.h" | 17 #include "GrDrawTargetCaps.h" |
18 #include "GrGpu.h" | 18 #include "GrGpu.h" |
19 #include "GrIndexBuffer.h" | 19 #include "GrIndexBuffer.h" |
20 #include "GrInOrderDrawBuffer.h" | 20 #include "GrInOrderDrawBuffer.h" |
21 #include "GrLayerCache.h" | 21 #include "GrLayerCache.h" |
22 #include "GrOvalRenderer.h" | 22 #include "GrOvalRenderer.h" |
23 #include "GrPathRenderer.h" | 23 #include "GrPathRenderer.h" |
24 #include "GrPathUtils.h" | 24 #include "GrPathUtils.h" |
25 #include "GrResourceCache2.h" | 25 #include "GrResourceCache2.h" |
26 #include "GrSoftwarePathRenderer.h" | 26 #include "GrSoftwarePathRenderer.h" |
27 #include "GrStencilBuffer.h" | |
28 #include "GrStencilAndCoverTextContext.h" | 27 #include "GrStencilAndCoverTextContext.h" |
29 #include "GrStrokeInfo.h" | 28 #include "GrStrokeInfo.h" |
30 #include "GrSurfacePriv.h" | 29 #include "GrSurfacePriv.h" |
31 #include "GrTextStrike.h" | 30 #include "GrTextStrike.h" |
32 #include "GrTexturePriv.h" | 31 #include "GrTexturePriv.h" |
33 #include "GrTraceMarker.h" | 32 #include "GrTraceMarker.h" |
34 #include "GrTracing.h" | 33 #include "GrTracing.h" |
35 #include "SkDashPathPriv.h" | 34 #include "SkDashPathPriv.h" |
36 #include "SkConfig8888.h" | 35 #include "SkConfig8888.h" |
37 #include "SkGr.h" | 36 #include "SkGr.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 return NULL; | 244 return NULL; |
246 } | 245 } |
247 | 246 |
248 bool GrContext::isTextureInCache(const GrSurfaceDesc& desc, | 247 bool GrContext::isTextureInCache(const GrSurfaceDesc& desc, |
249 const GrCacheID& cacheID, | 248 const GrCacheID& cacheID, |
250 const GrTextureParams* params) const { | 249 const GrTextureParams* params) const { |
251 GrResourceKey resourceKey = GrTexturePriv::ComputeKey(fGpu, params, desc, ca
cheID); | 250 GrResourceKey resourceKey = GrTexturePriv::ComputeKey(fGpu, params, desc, ca
cheID); |
252 return fResourceCache2->hasContentKey(resourceKey); | 251 return fResourceCache2->hasContentKey(resourceKey); |
253 } | 252 } |
254 | 253 |
255 void GrContext::addStencilBuffer(GrStencilBuffer* sb) { | |
256 // TODO: Make GrStencilBuffers use the scratch mechanism rather than content
keys. | |
257 ASSERT_OWNED_RESOURCE(sb); | |
258 | |
259 GrResourceKey resourceKey = GrStencilBuffer::ComputeKey(sb->width(), | |
260 sb->height(), | |
261 sb->numSamples()); | |
262 SkAssertResult(sb->cacheAccess().setContentKey(resourceKey)); | |
263 } | |
264 | |
265 GrStencilBuffer* GrContext::findAndRefStencilBuffer(int width, int height, int s
ampleCnt) { | |
266 GrResourceKey resourceKey = GrStencilBuffer::ComputeKey(width, height, sampl
eCnt); | |
267 GrGpuResource* resource = this->findAndRefCachedResource(resourceKey); | |
268 return static_cast<GrStencilBuffer*>(resource); | |
269 } | |
270 | |
271 static void stretch_image(void* dst, | 254 static void stretch_image(void* dst, |
272 int dstW, | 255 int dstW, |
273 int dstH, | 256 int dstH, |
274 const void* src, | 257 const void* src, |
275 int srcW, | 258 int srcW, |
276 int srcH, | 259 int srcH, |
277 size_t bpp) { | 260 size_t bpp) { |
278 SkFixed dx = (srcW << 16) / dstW; | 261 SkFixed dx = (srcW << 16) / dstW; |
279 SkFixed dy = (srcH << 16) / dstH; | 262 SkFixed dy = (srcH << 16) / dstH; |
280 | 263 |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 fResourceCache2->printStats(); | 1709 fResourceCache2->printStats(); |
1727 } | 1710 } |
1728 #endif | 1711 #endif |
1729 | 1712 |
1730 #if GR_GPU_STATS | 1713 #if GR_GPU_STATS |
1731 const GrContext::GPUStats* GrContext::gpuStats() const { | 1714 const GrContext::GPUStats* GrContext::gpuStats() const { |
1732 return fGpu->gpuStats(); | 1715 return fGpu->gpuStats(); |
1733 } | 1716 } |
1734 #endif | 1717 #endif |
1735 | 1718 |
OLD | NEW |