OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
11 #include "GrCaps.h" | 11 #include "GrCaps.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "GrPath.h" | 13 #include "GrPath.h" |
14 #include "GrPipeline.h" | 14 #include "GrPipeline.h" |
15 #include "GrMemoryPool.h" | 15 #include "GrMemoryPool.h" |
16 #include "GrRenderTarget.h" | 16 #include "GrRenderTarget.h" |
17 #include "GrResourceProvider.h" | 17 #include "GrResourceProvider.h" |
18 #include "GrRenderTargetPriv.h" | 18 #include "GrRenderTargetPriv.h" |
19 #include "GrSurfacePriv.h" | 19 #include "GrSurfacePriv.h" |
20 #include "GrTexture.h" | 20 #include "GrTexture.h" |
21 #include "GrVertexBuffer.h" | 21 #include "GrVertexBuffer.h" |
22 | 22 |
23 #include "batches/GrClearBatch.h" | 23 #include "batches/GrClearBatch.h" |
24 #include "batches/GrCopySurfaceBatch.h" | 24 #include "batches/GrCopySurfaceBatch.h" |
25 #include "batches/GrDiscardBatch.h" | 25 #include "batches/GrDiscardBatch.h" |
26 #include "batches/GrDrawBatch.h" | 26 #include "batches/GrDrawBatch.h" |
27 #include "batches/GrRectBatchFactory.h" | 27 #include "batches/GrRectBatchFactory.h" |
| 28 #include "batches/GrStencilPathBatch.h" |
28 | 29 |
29 #include "SkStrokeRec.h" | 30 #include "SkStrokeRec.h" |
30 | 31 |
31 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
32 | 33 |
33 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) | 34 GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) |
34 : fGpu(SkRef(gpu)) | 35 : fGpu(SkRef(gpu)) |
35 , fCaps(SkRef(gpu->caps())) | 36 , fCaps(SkRef(gpu->caps())) |
36 , fResourceProvider(resourceProvider) | 37 , fResourceProvider(resourceProvider) |
37 , fGpuTraceMarkerCount(0) | 38 , fGpuTraceMarkerCount(0) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) { | 206 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, NULL)) { |
206 return; | 207 return; |
207 } | 208 } |
208 | 209 |
209 // set stencil settings for path | 210 // set stencil settings for path |
210 GrStencilSettings stencilSettings; | 211 GrStencilSettings stencilSettings; |
211 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 212 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
212 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); | 213 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
213 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 214 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
214 | 215 |
215 this->onStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSe
ttings); | 216 GrBatch* batch = GrStencilPathBatch::Create(pathProc->viewMatrix(), |
| 217 pipelineBuilder.isHWAntialias(), |
| 218 stencilSettings, scissorState, |
| 219 pipelineBuilder.getRenderTarget(
), |
| 220 path); |
| 221 this->onDrawBatch(batch); |
| 222 batch->unref(); |
216 } | 223 } |
217 | 224 |
218 void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder, | 225 void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder, |
219 const GrPathProcessor* pathProc, | 226 const GrPathProcessor* pathProc, |
220 const GrPath* path, | 227 const GrPath* path, |
221 GrPathRendering::FillType fill) { | 228 GrPathRendering::FillType fill) { |
222 // TODO: extract portions of checkDraw that are relevant to path rendering. | 229 // TODO: extract portions of checkDraw that are relevant to path rendering. |
223 SkASSERT(path); | 230 SkASSERT(path); |
224 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); | 231 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); |
225 | 232 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 // The clip mask manager can rebuild all its clip masks so just | 475 // The clip mask manager can rebuild all its clip masks so just |
469 // get rid of them all. | 476 // get rid of them all. |
470 fClipMaskManager->purgeResources(); | 477 fClipMaskManager->purgeResources(); |
471 }; | 478 }; |
472 | 479 |
473 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 480 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
474 GrBatch* batch = SkNEW_ARGS(GrClearStencilClipBatch, (rect, insideClip, rt))
; | 481 GrBatch* batch = SkNEW_ARGS(GrClearStencilClipBatch, (rect, insideClip, rt))
; |
475 this->onDrawBatch(batch); | 482 this->onDrawBatch(batch); |
476 batch->unref(); | 483 batch->unref(); |
477 } | 484 } |
OLD | NEW |