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 "GrBatch.h" | 11 #include "GrBatch.h" |
12 #include "GrBufferAllocPool.h" | 12 #include "GrBufferAllocPool.h" |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrDrawTargetCaps.h" | 14 #include "GrDrawTargetCaps.h" |
15 #include "GrPath.h" | 15 #include "GrPath.h" |
16 #include "GrPipeline.h" | 16 #include "GrPipeline.h" |
17 #include "GrMemoryPool.h" | 17 #include "GrMemoryPool.h" |
| 18 #include "GrRectBatch.h" |
18 #include "GrRenderTarget.h" | 19 #include "GrRenderTarget.h" |
19 #include "GrRenderTargetPriv.h" | 20 #include "GrRenderTargetPriv.h" |
20 #include "GrSurfacePriv.h" | 21 #include "GrSurfacePriv.h" |
21 #include "GrTemplates.h" | 22 #include "GrTemplates.h" |
22 #include "GrTexture.h" | 23 #include "GrTexture.h" |
23 #include "GrVertexBuffer.h" | 24 #include "GrVertexBuffer.h" |
24 | 25 |
25 #include "SkStrokeRec.h" | 26 #include "SkStrokeRec.h" |
26 | 27 |
27 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // support NV_blend_equation_advanced. | 296 // support NV_blend_equation_advanced. |
296 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
Proc, NULL, this); | 297 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
Proc, NULL, this); |
297 if (pipelineInfo.mustSkipDraw()) { | 298 if (pipelineInfo.mustSkipDraw()) { |
298 return; | 299 return; |
299 } | 300 } |
300 | 301 |
301 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, | 302 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, |
302 transformType, count, stencilSettings, pipelineInfo); | 303 transformType, count, stencilSettings, pipelineInfo); |
303 } | 304 } |
304 | 305 |
| 306 void GrDrawTarget::drawRect(GrPipelineBuilder* pipelineBuilder, |
| 307 GrColor color, |
| 308 const SkMatrix& viewMatrix, |
| 309 const SkRect& rect, |
| 310 const SkRect* localRect, |
| 311 const SkMatrix* localMatrix) { |
| 312 SkAutoTUnref<GrBatch> batch(GrRectBatch::Create(color, viewMatrix, rect, loca
lRect, |
| 313 localMatrix)); |
| 314 this->drawBatch(pipelineBuilder, batch); |
| 315 } |
| 316 |
305 void GrDrawTarget::clear(const SkIRect* rect, | 317 void GrDrawTarget::clear(const SkIRect* rect, |
306 GrColor color, | 318 GrColor color, |
307 bool canIgnoreRect, | 319 bool canIgnoreRect, |
308 GrRenderTarget* renderTarget) { | 320 GrRenderTarget* renderTarget) { |
309 if (fCaps->useDrawInsteadOfClear()) { | 321 if (fCaps->useDrawInsteadOfClear()) { |
310 // This works around a driver bug with clear by drawing a rect instead. | 322 // This works around a driver bug with clear by drawing a rect instead. |
311 // The driver will ignore a clear if it is the only thing rendered to a | 323 // The driver will ignore a clear if it is the only thing rendered to a |
312 // target before the target is read. | 324 // target before the target is read. |
313 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->he
ight()); | 325 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->he
ight()); |
314 if (NULL == rect || canIgnoreRect || rect->contains(rtRect)) { | 326 if (NULL == rect || canIgnoreRect || rect->contains(rtRect)) { |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, | 775 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, |
764 GrPipelineBuilder::AutoRestoreStencil* ars, | 776 GrPipelineBuilder::AutoRestoreStencil* ars, |
765 GrScissorState* scissorState, | 777 GrScissorState* scissorState, |
766 const SkRect* devBounds) { | 778 const SkRect* devBounds) { |
767 return fClipMaskManager.setupClipping(pipelineBuilder, | 779 return fClipMaskManager.setupClipping(pipelineBuilder, |
768 arfp, | 780 arfp, |
769 ars, | 781 ars, |
770 scissorState, | 782 scissorState, |
771 devBounds); | 783 devBounds); |
772 } | 784 } |
OLD | NEW |