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" |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 pipelineBuilder.setDisableColorXPFactory(); | 702 pipelineBuilder.setDisableColorXPFactory(); |
703 } | 703 } |
704 | 704 |
705 drawContext->drawBatch(pipelineBuilder, clip, batch); | 705 drawContext->drawBatch(pipelineBuilder, clip, batch); |
706 } | 706 } |
707 } | 707 } |
708 return true; | 708 return true; |
709 } | 709 } |
710 | 710 |
711 bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { | 711 bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
712 // This path renderer does not support hairlines. We defer on anything that
could be handled | 712 // This path renderer only fills and relies on MSAA for antialiasing. Stroke
d shapes are |
713 // as a hairline by another path renderer. Also, arbitrary path effects coul
d produce | 713 // handled by passing on the original shape and letting the caller compute t
he stroked shape |
714 // a hairline result. | 714 // which will have a fill style. |
715 return !IsStrokeHairlineOrEquivalent(args.fShape->style(), *args.fViewMatrix
, nullptr) && | 715 return args.fShape->style().isSimpleFill() && !args.fAntiAlias; |
716 !args.fShape->style().couldBeHairline() && !args.fAntiAlias; | |
717 } | 716 } |
718 | 717 |
719 bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) { | 718 bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) { |
720 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), | 719 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
721 "GrMSAAPathRenderer::onDrawPath"); | 720 "GrMSAAPathRenderer::onDrawPath"); |
722 SkTLazy<GrShape> tmpShape; | 721 SkTLazy<GrShape> tmpShape; |
723 const GrShape* shape = args.fShape; | 722 const GrShape* shape = args.fShape; |
724 if (shape->style().applies()) { | 723 if (shape->style().applies()) { |
725 SkScalar styleScale = GrStyle::MatrixToScaleFactor(*args.fViewMatrix); | 724 SkScalar styleScale = GrStyle::MatrixToScaleFactor(*args.fViewMatrix); |
726 tmpShape.init(args.fShape->applyStyle(GrStyle::Apply::kPathEffectAndStro
keRec, styleScale)); | 725 tmpShape.init(args.fShape->applyStyle(GrStyle::Apply::kPathEffectAndStro
keRec, styleScale)); |
(...skipping 17 matching lines...) Expand all Loading... |
744 | 743 |
745 GrPaint paint; | 744 GrPaint paint; |
746 paint.setXPFactory(GrDisableColorXPFactory::Make()); | 745 paint.setXPFactory(GrDisableColorXPFactory::Make()); |
747 paint.setAntiAlias(args.fIsAA); | 746 paint.setAntiAlias(args.fIsAA); |
748 | 747 |
749 this->internalDrawPath(args.fDrawContext, paint, &GrUserStencilSettings::kUn
used, *args.fClip, | 748 this->internalDrawPath(args.fDrawContext, paint, &GrUserStencilSettings::kUn
used, *args.fClip, |
750 GrColor_WHITE, *args.fViewMatrix, *args.fShape, true)
; | 749 GrColor_WHITE, *args.fViewMatrix, *args.fShape, true)
; |
751 } | 750 } |
752 | 751 |
753 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 752 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
OLD | NEW |