OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrMSAAPathRenderer.h" | 8 #include "GrMSAAPathRenderer.h" |
9 | 9 |
10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
11 #include "GrBatchFlushState.h" | 11 #include "GrBatchFlushState.h" |
12 #include "GrClip.h" | 12 #include "GrClip.h" |
13 #include "GrDefaultGeoProcFactory.h" | 13 #include "GrDefaultGeoProcFactory.h" |
14 #include "GrPathStencilSettings.h" | 14 #include "GrPathStencilSettings.h" |
15 #include "GrPathUtils.h" | 15 #include "GrPathUtils.h" |
| 16 #include "GrPipelineBuilder.h" |
16 #include "GrMesh.h" | 17 #include "GrMesh.h" |
17 #include "SkGeometry.h" | 18 #include "SkGeometry.h" |
18 #include "SkTraceEvent.h" | 19 #include "SkTraceEvent.h" |
19 #include "glsl/GrGLSLGeometryProcessor.h" | 20 #include "glsl/GrGLSLGeometryProcessor.h" |
20 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 21 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
21 #include "glsl/GrGLSLVertexShaderBuilder.h" | 22 #include "glsl/GrGLSLVertexShaderBuilder.h" |
22 #include "glsl/GrGLSLProgramDataManager.h" | 23 #include "glsl/GrGLSLProgramDataManager.h" |
23 #include "glsl/GrGLSLUtil.h" | 24 #include "glsl/GrGLSLUtil.h" |
24 #include "gl/GrGLVaryingHandler.h" | 25 #include "gl/GrGLVaryingHandler.h" |
25 #include "batches/GrRectBatchFactory.h" | 26 #include "batches/GrRectBatchFactory.h" |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 650 } |
650 } else { | 651 } else { |
651 bounds = path.getBounds(); | 652 bounds = path.getBounds(); |
652 } | 653 } |
653 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : | 654 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : |
654 v
iewMatrix; | 655 v
iewMatrix; |
655 SkAutoTUnref<GrDrawBatch> batch( | 656 SkAutoTUnref<GrDrawBatch> batch( |
656 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM,
bounds, nullptr, | 657 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM,
bounds, nullptr, |
657 &localMatrix)); | 658 &localMatrix)); |
658 | 659 |
659 drawContext->drawBatch(paint, clip, *passes[p], batch); | 660 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); |
| 661 pipelineBuilder.setUserStencil(passes[p]); |
| 662 |
| 663 drawContext->drawBatch(pipelineBuilder, clip, batch); |
660 } else { | 664 } else { |
661 SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor()
, path, | 665 SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor()
, path, |
662 viewMatrix, devB
ounds)); | 666 viewMatrix, devB
ounds)); |
663 if (!batch->isValid()) { | 667 if (!batch->isValid()) { |
664 return false; | 668 return false; |
665 } | 669 } |
666 | 670 |
667 SkTCopyOnFirstWrite<GrPaint> newPaint(paint); | 671 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); |
| 672 pipelineBuilder.setUserStencil(passes[p]); |
668 if (passCount > 1) { | 673 if (passCount > 1) { |
669 newPaint.writable()->setXPFactory(GrDisableColorXPFactory::Make()
); | 674 pipelineBuilder.setDisableColorXPFactory(); |
670 } | 675 } |
671 | 676 |
672 drawContext->drawBatch(*newPaint, clip, *passes[p], batch); | 677 drawContext->drawBatch(pipelineBuilder, clip, batch); |
673 } | 678 } |
674 } | 679 } |
675 return true; | 680 return true; |
676 } | 681 } |
677 | 682 |
678 bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { | 683 bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
679 // This path renderer only fills and relies on MSAA for antialiasing. Stroke
d shapes are | 684 // This path renderer only fills and relies on MSAA for antialiasing. Stroke
d shapes are |
680 // handled by passing on the original shape and letting the caller compute t
he stroked shape | 685 // handled by passing on the original shape and letting the caller compute t
he stroked shape |
681 // which will have a fill style. | 686 // which will have a fill style. |
682 return args.fShape->style().isSimpleFill() && !args.fAntiAlias; | 687 return args.fShape->style().isSimpleFill() && !args.fAntiAlias; |
(...skipping 26 matching lines...) Expand all Loading... |
709 | 714 |
710 GrPaint paint; | 715 GrPaint paint; |
711 paint.setXPFactory(GrDisableColorXPFactory::Make()); | 716 paint.setXPFactory(GrDisableColorXPFactory::Make()); |
712 paint.setAntiAlias(args.fIsAA); | 717 paint.setAntiAlias(args.fIsAA); |
713 | 718 |
714 this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnu
sed, *args.fClip, | 719 this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnu
sed, *args.fClip, |
715 *args.fViewMatrix, *args.fShape, true); | 720 *args.fViewMatrix, *args.fShape, true); |
716 } | 721 } |
717 | 722 |
718 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 723 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
OLD | NEW |