OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrDashingEffect.h" | 8 #include "GrDashingEffect.h" |
9 | 9 |
10 #include "../GrAARectRenderer.h" | 10 #include "../GrAARectRenderer.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 if (info.fCount != 2 || info.fIntervals[0] != 0) { | 578 if (info.fCount != 2 || info.fIntervals[0] != 0) { |
579 return NULL; | 579 return NULL; |
580 } | 580 } |
581 | 581 |
582 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); | 582 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); |
583 } | 583 } |
584 | 584 |
585 DashingCircleEffect::~DashingCircleEffect() {} | 585 DashingCircleEffect::~DashingCircleEffect() {} |
586 | 586 |
587 void DashingCircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const
{ | 587 void DashingCircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const
{ |
588 inout->fValidFlags = 0; | 588 inout->mulByUnknownAlpha(); |
589 inout->fIsSingleComponent = false; | |
590 } | 589 } |
591 | 590 |
592 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const
{ | 591 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const
{ |
593 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance(
); | 592 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance(
); |
594 } | 593 } |
595 | 594 |
596 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das
hInfo& info, | 595 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das
hInfo& info, |
597 SkScalar radius) | 596 SkScalar radius) |
598 : fEdgeType(edgeType) | 597 : fEdgeType(edgeType) |
599 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord", | 598 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord", |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 if (info.fCount != 2) { | 801 if (info.fCount != 2) { |
803 return NULL; | 802 return NULL; |
804 } | 803 } |
805 | 804 |
806 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); | 805 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); |
807 } | 806 } |
808 | 807 |
809 DashingLineEffect::~DashingLineEffect() {} | 808 DashingLineEffect::~DashingLineEffect() {} |
810 | 809 |
811 void DashingLineEffect::onComputeInvariantOutput(InvariantOutput* inout) const { | 810 void DashingLineEffect::onComputeInvariantOutput(InvariantOutput* inout) const { |
812 inout->fValidFlags = 0; | 811 inout->mulByUnknownAlpha(); |
813 inout->fIsSingleComponent = false; | |
814 } | 812 } |
815 | 813 |
816 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { | 814 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { |
817 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance(); | 815 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance(); |
818 } | 816 } |
819 | 817 |
820 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf
o& info, | 818 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf
o& info, |
821 SkScalar strokeWidth) | 819 SkScalar strokeWidth) |
822 : fEdgeType(edgeType) | 820 : fEdgeType(edgeType) |
823 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord", | 821 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord", |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 switch (cap) { | 865 switch (cap) { |
868 case GrDashingEffect::kRound_DashCap: | 866 case GrDashingEffect::kRound_DashCap: |
869 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); | 867 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); |
870 case GrDashingEffect::kNonRound_DashCap: | 868 case GrDashingEffect::kNonRound_DashCap: |
871 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 869 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
872 default: | 870 default: |
873 SkFAIL("Unexpected dashed cap."); | 871 SkFAIL("Unexpected dashed cap."); |
874 } | 872 } |
875 return NULL; | 873 return NULL; |
876 } | 874 } |
OLD | NEW |