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 | |
461 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 459 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
462 | 460 |
463 private: | 461 private: |
464 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc
alar radius); | 462 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc
alar radius); |
465 | 463 |
466 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 464 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
467 | 465 |
| 466 virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFla
gs, |
| 467 bool* isSingleComponent) const SK_
OVERRIDE; |
| 468 |
468 GrPrimitiveEdgeType fEdgeType; | 469 GrPrimitiveEdgeType fEdgeType; |
469 const GrShaderVar& fInCoord; | 470 const GrShaderVar& fInCoord; |
470 SkScalar fIntervalLength; | 471 SkScalar fIntervalLength; |
471 SkScalar fRadius; | 472 SkScalar fRadius; |
472 SkScalar fCenterX; | 473 SkScalar fCenterX; |
473 | 474 |
474 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 475 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
475 | 476 |
476 typedef GrGeometryProcessor INHERITED; | 477 typedef GrGeometryProcessor INHERITED; |
477 }; | 478 }; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 SkScalar radius) { | 578 SkScalar radius) { |
578 if (info.fCount != 2 || info.fIntervals[0] != 0) { | 579 if (info.fCount != 2 || info.fIntervals[0] != 0) { |
579 return NULL; | 580 return NULL; |
580 } | 581 } |
581 | 582 |
582 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); | 583 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); |
583 } | 584 } |
584 | 585 |
585 DashingCircleEffect::~DashingCircleEffect() {} | 586 DashingCircleEffect::~DashingCircleEffect() {} |
586 | 587 |
587 void DashingCircleEffect::getConstantColorComponents(GrColor* color, uint32_t* v
alidFlags) const { | 588 void DashingCircleEffect::onGetConstantColorComponents(GrColor* color, uint32_t*
validFlags, |
| 589 bool* isSingleComponent)
const { |
588 *validFlags = 0; | 590 *validFlags = 0; |
589 } | 591 } |
590 | 592 |
591 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const
{ | 593 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const
{ |
592 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance(
); | 594 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance(
); |
593 } | 595 } |
594 | 596 |
595 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das
hInfo& info, | 597 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das
hInfo& info, |
596 SkScalar radius) | 598 SkScalar radius) |
597 : fEdgeType(edgeType) | 599 : fEdgeType(edgeType) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 const GrShaderVar& inCoord() const { return fInCoord; } | 663 const GrShaderVar& inCoord() const { return fInCoord; } |
662 | 664 |
663 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 665 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
664 | 666 |
665 const SkRect& getRect() const { return fRect; } | 667 const SkRect& getRect() const { return fRect; } |
666 | 668 |
667 SkScalar getIntervalLength() const { return fIntervalLength; } | 669 SkScalar getIntervalLength() const { return fIntervalLength; } |
668 | 670 |
669 typedef GLDashingLineEffect GLProcessor; | 671 typedef GLDashingLineEffect GLProcessor; |
670 | 672 |
671 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
672 | |
673 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 673 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
674 | 674 |
675 private: | 675 private: |
676 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal
ar strokeWidth); | 676 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal
ar strokeWidth); |
677 | 677 |
678 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 678 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
679 | 679 |
| 680 virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFla
gs, |
| 681 bool* isSingleComponent) const SK_
OVERRIDE; |
| 682 |
680 GrPrimitiveEdgeType fEdgeType; | 683 GrPrimitiveEdgeType fEdgeType; |
681 const GrShaderVar& fInCoord; | 684 const GrShaderVar& fInCoord; |
682 SkRect fRect; | 685 SkRect fRect; |
683 SkScalar fIntervalLength; | 686 SkScalar fIntervalLength; |
684 | 687 |
685 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 688 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
686 | 689 |
687 typedef GrGeometryProcessor INHERITED; | 690 typedef GrGeometryProcessor INHERITED; |
688 }; | 691 }; |
689 | 692 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 SkScalar strokeWidth) { | 803 SkScalar strokeWidth) { |
801 if (info.fCount != 2) { | 804 if (info.fCount != 2) { |
802 return NULL; | 805 return NULL; |
803 } | 806 } |
804 | 807 |
805 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); | 808 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); |
806 } | 809 } |
807 | 810 |
808 DashingLineEffect::~DashingLineEffect() {} | 811 DashingLineEffect::~DashingLineEffect() {} |
809 | 812 |
810 void DashingLineEffect::getConstantColorComponents(GrColor* color, uint32_t* val
idFlags) const { | 813 void DashingLineEffect::onGetConstantColorComponents(GrColor* color, uint32_t* v
alidFlags, |
| 814 bool* isSingleComponent) co
nst { |
811 *validFlags = 0; | 815 *validFlags = 0; |
812 } | 816 } |
813 | 817 |
814 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { | 818 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { |
815 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance(); | 819 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance(); |
816 } | 820 } |
817 | 821 |
818 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf
o& info, | 822 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf
o& info, |
819 SkScalar strokeWidth) | 823 SkScalar strokeWidth) |
820 : fEdgeType(edgeType) | 824 : fEdgeType(edgeType) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 switch (cap) { | 869 switch (cap) { |
866 case GrDashingEffect::kRound_DashCap: | 870 case GrDashingEffect::kRound_DashCap: |
867 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); | 871 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); |
868 case GrDashingEffect::kNonRound_DashCap: | 872 case GrDashingEffect::kNonRound_DashCap: |
869 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 873 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
870 default: | 874 default: |
871 SkFAIL("Unexpected dashed cap."); | 875 SkFAIL("Unexpected dashed cap."); |
872 } | 876 } |
873 return NULL; | 877 return NULL; |
874 } | 878 } |
OLD | NEW |