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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 } | 556 } |
557 | 557 |
558 ////////////////////////////////////////////////////////////////////////////// | 558 ////////////////////////////////////////////////////////////////////////////// |
559 | 559 |
560 GrEffectRef* DashingCircleEffect::Create(GrEffectEdgeType edgeType, const DashIn
fo& info, | 560 GrEffectRef* DashingCircleEffect::Create(GrEffectEdgeType edgeType, const DashIn
fo& info, |
561 SkScalar radius) { | 561 SkScalar radius) { |
562 if (info.fCount != 2 || info.fIntervals[0] != 0) { | 562 if (info.fCount != 2 || info.fIntervals[0] != 0) { |
563 return NULL; | 563 return NULL; |
564 } | 564 } |
565 | 565 |
566 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(DashingCircleEffect, | 566 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); |
567 (edgeType, info, radius)))
); | |
568 } | 567 } |
569 | 568 |
570 DashingCircleEffect::~DashingCircleEffect() {} | 569 DashingCircleEffect::~DashingCircleEffect() {} |
571 | 570 |
572 void DashingCircleEffect::getConstantColorComponents(GrColor* color, uint32_t* v
alidFlags) const { | 571 void DashingCircleEffect::getConstantColorComponents(GrColor* color, uint32_t* v
alidFlags) const { |
573 *validFlags = 0; | 572 *validFlags = 0; |
574 } | 573 } |
575 | 574 |
576 const GrBackendEffectFactory& DashingCircleEffect::getFactory() const { | 575 const GrBackendEffectFactory& DashingCircleEffect::getFactory() const { |
577 return GrTBackendEffectFactory<DashingCircleEffect>::getInstance(); | 576 return GrTBackendEffectFactory<DashingCircleEffect>::getInstance(); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 } | 774 } |
776 | 775 |
777 ////////////////////////////////////////////////////////////////////////////// | 776 ////////////////////////////////////////////////////////////////////////////// |
778 | 777 |
779 GrEffectRef* DashingLineEffect::Create(GrEffectEdgeType edgeType, const DashInfo
& info, | 778 GrEffectRef* DashingLineEffect::Create(GrEffectEdgeType edgeType, const DashInfo
& info, |
780 SkScalar strokeWidth) { | 779 SkScalar strokeWidth) { |
781 if (info.fCount != 2) { | 780 if (info.fCount != 2) { |
782 return NULL; | 781 return NULL; |
783 } | 782 } |
784 | 783 |
785 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(DashingLineEffect, | 784 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); |
786 (edgeType, info, strokeWid
th)))); | |
787 } | 785 } |
788 | 786 |
789 DashingLineEffect::~DashingLineEffect() {} | 787 DashingLineEffect::~DashingLineEffect() {} |
790 | 788 |
791 void DashingLineEffect::getConstantColorComponents(GrColor* color, uint32_t* val
idFlags) const { | 789 void DashingLineEffect::getConstantColorComponents(GrColor* color, uint32_t* val
idFlags) const { |
792 *validFlags = 0; | 790 *validFlags = 0; |
793 } | 791 } |
794 | 792 |
795 const GrBackendEffectFactory& DashingLineEffect::getFactory() const { | 793 const GrBackendEffectFactory& DashingLineEffect::getFactory() const { |
796 return GrTBackendEffectFactory<DashingLineEffect>::getInstance(); | 794 return GrTBackendEffectFactory<DashingLineEffect>::getInstance(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 switch (cap) { | 843 switch (cap) { |
846 case GrDashingEffect::kRound_DashCap: | 844 case GrDashingEffect::kRound_DashCap: |
847 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); | 845 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); |
848 case GrDashingEffect::kNonRound_DashCap: | 846 case GrDashingEffect::kNonRound_DashCap: |
849 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 847 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
850 default: | 848 default: |
851 SkFAIL("Unexpected dashed cap."); | 849 SkFAIL("Unexpected dashed cap."); |
852 } | 850 } |
853 return NULL; | 851 return NULL; |
854 } | 852 } |
OLD | NEW |