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