| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 449 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
| 450 | 450 |
| 451 SkScalar getRadius() const { return fRadius; } | 451 SkScalar getRadius() const { return fRadius; } |
| 452 | 452 |
| 453 SkScalar getCenterX() const { return fCenterX; } | 453 SkScalar getCenterX() const { return fCenterX; } |
| 454 | 454 |
| 455 SkScalar getIntervalLength() const { return fIntervalLength; } | 455 SkScalar getIntervalLength() const { return fIntervalLength; } |
| 456 | 456 |
| 457 typedef GLDashingCircleEffect GLProcessor; | 457 typedef GLDashingCircleEffect GLProcessor; |
| 458 | 458 |
| 459 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; |
| 460 |
| 459 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 461 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 460 | 462 |
| 461 private: | 463 private: |
| 462 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc
alar radius); | 464 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc
alar radius); |
| 463 | 465 |
| 464 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 466 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
| 465 | 467 |
| 466 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | |
| 467 | |
| 468 GrPrimitiveEdgeType fEdgeType; | 468 GrPrimitiveEdgeType fEdgeType; |
| 469 const GrShaderVar& fInCoord; | 469 const GrShaderVar& fInCoord; |
| 470 SkScalar fIntervalLength; | 470 SkScalar fIntervalLength; |
| 471 SkScalar fRadius; | 471 SkScalar fRadius; |
| 472 SkScalar fCenterX; | 472 SkScalar fCenterX; |
| 473 | 473 |
| 474 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 474 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 475 | 475 |
| 476 typedef GrGeometryProcessor INHERITED; | 476 typedef GrGeometryProcessor INHERITED; |
| 477 }; | 477 }; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 SkScalar radius) { | 577 SkScalar radius) { |
| 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::getConstantColorComponents(GrColor* color, uint32_t* v
alidFlags) const { |
| 588 inout->fValidFlags = 0; | 588 *validFlags = 0; |
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 const GrShaderVar& inCoord() const { return fInCoord; } | 661 const GrShaderVar& inCoord() const { return fInCoord; } |
| 663 | 662 |
| 664 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 663 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
| 665 | 664 |
| 666 const SkRect& getRect() const { return fRect; } | 665 const SkRect& getRect() const { return fRect; } |
| 667 | 666 |
| 668 SkScalar getIntervalLength() const { return fIntervalLength; } | 667 SkScalar getIntervalLength() const { return fIntervalLength; } |
| 669 | 668 |
| 670 typedef GLDashingLineEffect GLProcessor; | 669 typedef GLDashingLineEffect GLProcessor; |
| 671 | 670 |
| 671 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; |
| 672 |
| 672 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 673 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 673 | 674 |
| 674 private: | 675 private: |
| 675 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal
ar strokeWidth); | 676 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal
ar strokeWidth); |
| 676 | 677 |
| 677 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 678 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
| 678 | 679 |
| 679 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | |
| 680 | |
| 681 GrPrimitiveEdgeType fEdgeType; | 680 GrPrimitiveEdgeType fEdgeType; |
| 682 const GrShaderVar& fInCoord; | 681 const GrShaderVar& fInCoord; |
| 683 SkRect fRect; | 682 SkRect fRect; |
| 684 SkScalar fIntervalLength; | 683 SkScalar fIntervalLength; |
| 685 | 684 |
| 686 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 685 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 687 | 686 |
| 688 typedef GrGeometryProcessor INHERITED; | 687 typedef GrGeometryProcessor INHERITED; |
| 689 }; | 688 }; |
| 690 | 689 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 SkScalar strokeWidth) { | 800 SkScalar strokeWidth) { |
| 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::getConstantColorComponents(GrColor* color, uint32_t* val
idFlags) const { |
| 812 inout->fValidFlags = 0; | 811 *validFlags = 0; |
| 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 |