| 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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
| 9 #include "GrDashingEffect.h" | 9 #include "GrDashingEffect.h" |
| 10 | 10 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 471 |
| 472 GR_DECLARE_EFFECT_TEST; | 472 GR_DECLARE_EFFECT_TEST; |
| 473 | 473 |
| 474 typedef GrGeometryProcessor INHERITED; | 474 typedef GrGeometryProcessor INHERITED; |
| 475 }; | 475 }; |
| 476 | 476 |
| 477 ////////////////////////////////////////////////////////////////////////////// | 477 ////////////////////////////////////////////////////////////////////////////// |
| 478 | 478 |
| 479 class GLDashingCircleEffect : public GrGLGeometryProcessor { | 479 class GLDashingCircleEffect : public GrGLGeometryProcessor { |
| 480 public: | 480 public: |
| 481 GLDashingCircleEffect(const GrBackendEffectFactory&, const GrDrawEffect&); | 481 GLDashingCircleEffect(const GrBackendEffectFactory&, const GrEffect&); |
| 482 | 482 |
| 483 virtual void emitCode(GrGLFullProgramBuilder* builder, | 483 virtual void emitCode(GrGLFullProgramBuilder* builder, |
| 484 const GrDrawEffect& drawEffect, | 484 const GrEffect& effect, |
| 485 const GrEffectKey& key, | 485 const GrEffectKey& key, |
| 486 const char* outputColor, | 486 const char* outputColor, |
| 487 const char* inputColor, | 487 const char* inputColor, |
| 488 const TransformedCoordsArray&, | 488 const TransformedCoordsArray&, |
| 489 const TextureSamplerArray&) SK_OVERRIDE; | 489 const TextureSamplerArray&) SK_OVERRIDE; |
| 490 | 490 |
| 491 static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyB
uilder*); | 491 static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuild
er*); |
| 492 | 492 |
| 493 virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_
OVERRIDE; | 493 virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVER
RIDE; |
| 494 | 494 |
| 495 private: | 495 private: |
| 496 GrGLProgramDataManager::UniformHandle fParamUniform; | 496 GrGLProgramDataManager::UniformHandle fParamUniform; |
| 497 SkScalar fPrevRadius; | 497 SkScalar fPrevRadius; |
| 498 SkScalar fPrevCenterX; | 498 SkScalar fPrevCenterX; |
| 499 SkScalar fPrevIntervalLength; | 499 SkScalar fPrevIntervalLength; |
| 500 typedef GrGLGeometryProcessor INHERITED; | 500 typedef GrGLGeometryProcessor INHERITED; |
| 501 }; | 501 }; |
| 502 | 502 |
| 503 GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendEffectFactory& facto
ry, | 503 GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendEffectFactory& facto
ry, |
| 504 const GrDrawEffect& drawEffect) | 504 const GrEffect& effect) |
| 505 : INHERITED (factory) { | 505 : INHERITED (factory) { |
| 506 fPrevRadius = SK_ScalarMin; | 506 fPrevRadius = SK_ScalarMin; |
| 507 fPrevCenterX = SK_ScalarMin; | 507 fPrevCenterX = SK_ScalarMin; |
| 508 fPrevIntervalLength = SK_ScalarMax; | 508 fPrevIntervalLength = SK_ScalarMax; |
| 509 } | 509 } |
| 510 | 510 |
| 511 void GLDashingCircleEffect::emitCode(GrGLFullProgramBuilder* builder, | 511 void GLDashingCircleEffect::emitCode(GrGLFullProgramBuilder* builder, |
| 512 const GrDrawEffect& drawEffect, | 512 const GrEffect& effect, |
| 513 const GrEffectKey& key, | 513 const GrEffectKey& key, |
| 514 const char* outputColor, | 514 const char* outputColor, |
| 515 const char* inputColor, | 515 const char* inputColor, |
| 516 const TransformedCoordsArray&, | 516 const TransformedCoordsArray&, |
| 517 const TextureSamplerArray& samplers) { | 517 const TextureSamplerArray& samplers) { |
| 518 const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>(
); | 518 const DashingCircleEffect& dce = GrEffect::CastEffect<DashingCircleEffect>(e
ffect); |
| 519 const char *paramName; | 519 const char *paramName; |
| 520 // The param uniforms, xyz, refer to circle radius - 0.5, cicles center x co
ord, and | 520 // The param uniforms, xyz, refer to circle radius - 0.5, cicles center x co
ord, and |
| 521 // the total interval length of the dash. | 521 // the total interval length of the dash. |
| 522 fParamUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility
, | 522 fParamUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility
, |
| 523 kVec3f_GrSLType, | 523 kVec3f_GrSLType, |
| 524 "params", | 524 "params", |
| 525 ¶mName); | 525 ¶mName); |
| 526 | 526 |
| 527 const char *vsCoordName, *fsCoordName; | 527 const char *vsCoordName, *fsCoordName; |
| 528 builder->addVarying(kVec2f_GrSLType, "Coord", &vsCoordName, &fsCoordName); | 528 builder->addVarying(kVec2f_GrSLType, "Coord", &vsCoordName, &fsCoordName); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 542 fsBuilder->codeAppend("\t\tdiff = 1.0 - diff;\n"); | 542 fsBuilder->codeAppend("\t\tdiff = 1.0 - diff;\n"); |
| 543 fsBuilder->codeAppend("\t\tfloat alpha = clamp(diff, 0.0, 1.0);\n"); | 543 fsBuilder->codeAppend("\t\tfloat alpha = clamp(diff, 0.0, 1.0);\n"); |
| 544 } else { | 544 } else { |
| 545 fsBuilder->codeAppendf("\t\tfloat alpha = 1.0;\n"); | 545 fsBuilder->codeAppendf("\t\tfloat alpha = 1.0;\n"); |
| 546 fsBuilder->codeAppendf("\t\talpha *= dist < %s.x + 0.5 ? 1.0 : 0.0;\n",
paramName); | 546 fsBuilder->codeAppendf("\t\talpha *= dist < %s.x + 0.5 ? 1.0 : 0.0;\n",
paramName); |
| 547 } | 547 } |
| 548 fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor, | 548 fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor, |
| 549 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_st
r()); | 549 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_st
r()); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, const G
rDrawEffect& drawEffect) { | 552 void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, const G
rEffect& effect) { |
| 553 const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>(
); | 553 const DashingCircleEffect& dce = GrEffect::CastEffect<DashingCircleEffect>(e
ffect); |
| 554 SkScalar radius = dce.getRadius(); | 554 SkScalar radius = dce.getRadius(); |
| 555 SkScalar centerX = dce.getCenterX(); | 555 SkScalar centerX = dce.getCenterX(); |
| 556 SkScalar intervalLength = dce.getIntervalLength(); | 556 SkScalar intervalLength = dce.getIntervalLength(); |
| 557 if (radius != fPrevRadius || centerX != fPrevCenterX || intervalLength != fP
revIntervalLength) { | 557 if (radius != fPrevRadius || centerX != fPrevCenterX || intervalLength != fP
revIntervalLength) { |
| 558 pdman.set3f(fParamUniform, radius - 0.5f, centerX, intervalLength); | 558 pdman.set3f(fParamUniform, radius - 0.5f, centerX, intervalLength); |
| 559 fPrevRadius = radius; | 559 fPrevRadius = radius; |
| 560 fPrevCenterX = centerX; | 560 fPrevCenterX = centerX; |
| 561 fPrevIntervalLength = intervalLength; | 561 fPrevIntervalLength = intervalLength; |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | 564 |
| 565 void GLDashingCircleEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCap
s&, | 565 void GLDashingCircleEffect::GenKey(const GrEffect& effect, const GrGLCaps&, |
| 566 GrEffectKeyBuilder* b) { | 566 GrEffectKeyBuilder* b) { |
| 567 const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>(
); | 567 const DashingCircleEffect& dce = GrEffect::CastEffect<DashingCircleEffect>(e
ffect); |
| 568 b->add32(dce.getEdgeType()); | 568 b->add32(dce.getEdgeType()); |
| 569 } | 569 } |
| 570 | 570 |
| 571 ////////////////////////////////////////////////////////////////////////////// | 571 ////////////////////////////////////////////////////////////////////////////// |
| 572 | 572 |
| 573 GrEffect* DashingCircleEffect::Create(GrEffectEdgeType edgeType, const DashInfo&
info, | 573 GrEffect* DashingCircleEffect::Create(GrEffectEdgeType edgeType, const DashInfo&
info, |
| 574 SkScalar radius) { | 574 SkScalar radius) { |
| 575 if (info.fCount != 2 || info.fIntervals[0] != 0) { | 575 if (info.fCount != 2 || info.fIntervals[0] != 0) { |
| 576 return NULL; | 576 return NULL; |
| 577 } | 577 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 596 kVec2f_GrSLType, | 596 kVec2f_GrSLType, |
| 597 GrShaderVar::kAttribute_TypeMod
ifier))) { | 597 GrShaderVar::kAttribute_TypeMod
ifier))) { |
| 598 SkScalar onLen = info.fIntervals[0]; | 598 SkScalar onLen = info.fIntervals[0]; |
| 599 SkScalar offLen = info.fIntervals[1]; | 599 SkScalar offLen = info.fIntervals[1]; |
| 600 fIntervalLength = onLen + offLen; | 600 fIntervalLength = onLen + offLen; |
| 601 fRadius = radius; | 601 fRadius = radius; |
| 602 fCenterX = SkScalarHalf(offLen); | 602 fCenterX = SkScalarHalf(offLen); |
| 603 } | 603 } |
| 604 | 604 |
| 605 bool DashingCircleEffect::onIsEqual(const GrEffect& other) const { | 605 bool DashingCircleEffect::onIsEqual(const GrEffect& other) const { |
| 606 const DashingCircleEffect& dce = CastEffect<DashingCircleEffect>(other); | 606 const DashingCircleEffect& dce = GrEffect::CastEffect<DashingCircleEffect>(o
ther); |
| 607 return (fEdgeType == dce.fEdgeType && | 607 return (fEdgeType == dce.fEdgeType && |
| 608 fIntervalLength == dce.fIntervalLength && | 608 fIntervalLength == dce.fIntervalLength && |
| 609 fRadius == dce.fRadius && | 609 fRadius == dce.fRadius && |
| 610 fCenterX == dce.fCenterX); | 610 fCenterX == dce.fCenterX); |
| 611 } | 611 } |
| 612 | 612 |
| 613 GR_DEFINE_EFFECT_TEST(DashingCircleEffect); | 613 GR_DEFINE_EFFECT_TEST(DashingCircleEffect); |
| 614 | 614 |
| 615 GrEffect* DashingCircleEffect::TestCreate(SkRandom* random, | 615 GrEffect* DashingCircleEffect::TestCreate(SkRandom* random, |
| 616 GrContext*, | 616 GrContext*, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 | 681 |
| 682 GR_DECLARE_EFFECT_TEST; | 682 GR_DECLARE_EFFECT_TEST; |
| 683 | 683 |
| 684 typedef GrGeometryProcessor INHERITED; | 684 typedef GrGeometryProcessor INHERITED; |
| 685 }; | 685 }; |
| 686 | 686 |
| 687 ////////////////////////////////////////////////////////////////////////////// | 687 ////////////////////////////////////////////////////////////////////////////// |
| 688 | 688 |
| 689 class GLDashingLineEffect : public GrGLGeometryProcessor { | 689 class GLDashingLineEffect : public GrGLGeometryProcessor { |
| 690 public: | 690 public: |
| 691 GLDashingLineEffect(const GrBackendEffectFactory&, const GrDrawEffect&); | 691 GLDashingLineEffect(const GrBackendEffectFactory&, const GrEffect&); |
| 692 | 692 |
| 693 virtual void emitCode(GrGLFullProgramBuilder* builder, | 693 virtual void emitCode(GrGLFullProgramBuilder* builder, |
| 694 const GrDrawEffect& drawEffect, | 694 const GrEffect& effect, |
| 695 const GrEffectKey& key, | 695 const GrEffectKey& key, |
| 696 const char* outputColor, | 696 const char* outputColor, |
| 697 const char* inputColor, | 697 const char* inputColor, |
| 698 const TransformedCoordsArray&, | 698 const TransformedCoordsArray&, |
| 699 const TextureSamplerArray&) SK_OVERRIDE; | 699 const TextureSamplerArray&) SK_OVERRIDE; |
| 700 | 700 |
| 701 static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyB
uilder*); | 701 static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuild
er*); |
| 702 | 702 |
| 703 virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_
OVERRIDE; | 703 virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVER
RIDE; |
| 704 | 704 |
| 705 private: | 705 private: |
| 706 GrGLProgramDataManager::UniformHandle fRectUniform; | 706 GrGLProgramDataManager::UniformHandle fRectUniform; |
| 707 GrGLProgramDataManager::UniformHandle fIntervalUniform; | 707 GrGLProgramDataManager::UniformHandle fIntervalUniform; |
| 708 SkRect fPrevRect; | 708 SkRect fPrevRect; |
| 709 SkScalar fPrevIntervalLength; | 709 SkScalar fPrevIntervalLength; |
| 710 typedef GrGLGeometryProcessor INHERITED; | 710 typedef GrGLGeometryProcessor INHERITED; |
| 711 }; | 711 }; |
| 712 | 712 |
| 713 GLDashingLineEffect::GLDashingLineEffect(const GrBackendEffectFactory& factory, | 713 GLDashingLineEffect::GLDashingLineEffect(const GrBackendEffectFactory& factory, |
| 714 const GrDrawEffect& drawEffect) | 714 const GrEffect& effect) |
| 715 : INHERITED (factory) { | 715 : INHERITED (factory) { |
| 716 fPrevRect.fLeft = SK_ScalarNaN; | 716 fPrevRect.fLeft = SK_ScalarNaN; |
| 717 fPrevIntervalLength = SK_ScalarMax; | 717 fPrevIntervalLength = SK_ScalarMax; |
| 718 } | 718 } |
| 719 | 719 |
| 720 void GLDashingLineEffect::emitCode(GrGLFullProgramBuilder* builder, | 720 void GLDashingLineEffect::emitCode(GrGLFullProgramBuilder* builder, |
| 721 const GrDrawEffect& drawEffect, | 721 const GrEffect& effect, |
| 722 const GrEffectKey& key, | 722 const GrEffectKey& key, |
| 723 const char* outputColor, | 723 const char* outputColor, |
| 724 const char* inputColor, | 724 const char* inputColor, |
| 725 const TransformedCoordsArray&, | 725 const TransformedCoordsArray&, |
| 726 const TextureSamplerArray& samplers) { | 726 const TextureSamplerArray& samplers) { |
| 727 const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>(); | 727 const DashingLineEffect& de = GrEffect::CastEffect<DashingLineEffect>(effect
); |
| 728 const char *rectName; | 728 const char *rectName; |
| 729 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), | 729 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), |
| 730 // respectively. | 730 // respectively. |
| 731 fRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 731 fRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
| 732 kVec4f_GrSLType, | 732 kVec4f_GrSLType, |
| 733 "rect", | 733 "rect", |
| 734 &rectName); | 734 &rectName); |
| 735 const char *intervalName; | 735 const char *intervalName; |
| 736 // The interval uniform's refers to the total length of the interval (on + o
ff) | 736 // The interval uniform's refers to the total length of the interval (on + o
ff) |
| 737 fIntervalUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibil
ity, | 737 fIntervalUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibil
ity, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 763 } else { | 763 } else { |
| 764 // Assuming the bounding geometry is tight so no need to check y values | 764 // Assuming the bounding geometry is tight so no need to check y values |
| 765 fsBuilder->codeAppendf("\t\tfloat alpha = 1.0;\n"); | 765 fsBuilder->codeAppendf("\t\tfloat alpha = 1.0;\n"); |
| 766 fsBuilder->codeAppendf("\t\talpha *= (fragPosShifted.x - %s.x) > -0.5 ?
1.0 : 0.0;\n", rectName); | 766 fsBuilder->codeAppendf("\t\talpha *= (fragPosShifted.x - %s.x) > -0.5 ?
1.0 : 0.0;\n", rectName); |
| 767 fsBuilder->codeAppendf("\t\talpha *= (%s.z - fragPosShifted.x) >= -0.5 ?
1.0 : 0.0;\n", rectName); | 767 fsBuilder->codeAppendf("\t\talpha *= (%s.z - fragPosShifted.x) >= -0.5 ?
1.0 : 0.0;\n", rectName); |
| 768 } | 768 } |
| 769 fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor, | 769 fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor, |
| 770 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_st
r()); | 770 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_st
r()); |
| 771 } | 771 } |
| 772 | 772 |
| 773 void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, const GrD
rawEffect& drawEffect) { | 773 void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, const GrE
ffect& effect) { |
| 774 const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>(); | 774 const DashingLineEffect& de = GrEffect::CastEffect<DashingLineEffect>(effect
); |
| 775 const SkRect& rect = de.getRect(); | 775 const SkRect& rect = de.getRect(); |
| 776 SkScalar intervalLength = de.getIntervalLength(); | 776 SkScalar intervalLength = de.getIntervalLength(); |
| 777 if (rect != fPrevRect || intervalLength != fPrevIntervalLength) { | 777 if (rect != fPrevRect || intervalLength != fPrevIntervalLength) { |
| 778 pdman.set4f(fRectUniform, rect.fLeft + 0.5f, rect.fTop + 0.5f, | 778 pdman.set4f(fRectUniform, rect.fLeft + 0.5f, rect.fTop + 0.5f, |
| 779 rect.fRight - 0.5f, rect.fBottom - 0.5f); | 779 rect.fRight - 0.5f, rect.fBottom - 0.5f); |
| 780 pdman.set1f(fIntervalUniform, intervalLength); | 780 pdman.set1f(fIntervalUniform, intervalLength); |
| 781 fPrevRect = rect; | 781 fPrevRect = rect; |
| 782 fPrevIntervalLength = intervalLength; | 782 fPrevIntervalLength = intervalLength; |
| 783 } | 783 } |
| 784 } | 784 } |
| 785 | 785 |
| 786 void GLDashingLineEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&
, | 786 void GLDashingLineEffect::GenKey(const GrEffect& effect, const GrGLCaps&, |
| 787 GrEffectKeyBuilder* b) { | 787 GrEffectKeyBuilder* b) { |
| 788 const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>(); | 788 const DashingLineEffect& de = GrEffect::CastEffect<DashingLineEffect>(effect
); |
| 789 b->add32(de.getEdgeType()); | 789 b->add32(de.getEdgeType()); |
| 790 } | 790 } |
| 791 | 791 |
| 792 ////////////////////////////////////////////////////////////////////////////// | 792 ////////////////////////////////////////////////////////////////////////////// |
| 793 | 793 |
| 794 GrEffect* DashingLineEffect::Create(GrEffectEdgeType edgeType, const DashInfo& i
nfo, | 794 GrEffect* DashingLineEffect::Create(GrEffectEdgeType edgeType, const DashInfo& i
nfo, |
| 795 SkScalar strokeWidth) { | 795 SkScalar strokeWidth) { |
| 796 if (info.fCount != 2) { | 796 if (info.fCount != 2) { |
| 797 return NULL; | 797 return NULL; |
| 798 } | 798 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 818 GrShaderVar::kAttribute_TypeMod
ifier))) { | 818 GrShaderVar::kAttribute_TypeMod
ifier))) { |
| 819 SkScalar onLen = info.fIntervals[0]; | 819 SkScalar onLen = info.fIntervals[0]; |
| 820 SkScalar offLen = info.fIntervals[1]; | 820 SkScalar offLen = info.fIntervals[1]; |
| 821 SkScalar halfOffLen = SkScalarHalf(offLen); | 821 SkScalar halfOffLen = SkScalarHalf(offLen); |
| 822 SkScalar halfStroke = SkScalarHalf(strokeWidth); | 822 SkScalar halfStroke = SkScalarHalf(strokeWidth); |
| 823 fIntervalLength = onLen + offLen; | 823 fIntervalLength = onLen + offLen; |
| 824 fRect.set(halfOffLen, -halfStroke, halfOffLen + onLen, halfStroke); | 824 fRect.set(halfOffLen, -halfStroke, halfOffLen + onLen, halfStroke); |
| 825 } | 825 } |
| 826 | 826 |
| 827 bool DashingLineEffect::onIsEqual(const GrEffect& other) const { | 827 bool DashingLineEffect::onIsEqual(const GrEffect& other) const { |
| 828 const DashingLineEffect& de = CastEffect<DashingLineEffect>(other); | 828 const DashingLineEffect& de = GrEffect::CastEffect<DashingLineEffect>(other)
; |
| 829 return (fEdgeType == de.fEdgeType && | 829 return (fEdgeType == de.fEdgeType && |
| 830 fRect == de.fRect && | 830 fRect == de.fRect && |
| 831 fIntervalLength == de.fIntervalLength); | 831 fIntervalLength == de.fIntervalLength); |
| 832 } | 832 } |
| 833 | 833 |
| 834 GR_DEFINE_EFFECT_TEST(DashingLineEffect); | 834 GR_DEFINE_EFFECT_TEST(DashingLineEffect); |
| 835 | 835 |
| 836 GrEffect* DashingLineEffect::TestCreate(SkRandom* random, | 836 GrEffect* DashingLineEffect::TestCreate(SkRandom* random, |
| 837 GrContext*, | 837 GrContext*, |
| 838 const GrDrawTargetCaps& caps, | 838 const GrDrawTargetCaps& caps, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 860 switch (cap) { | 860 switch (cap) { |
| 861 case GrDashingEffect::kRound_DashCap: | 861 case GrDashingEffect::kRound_DashCap: |
| 862 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); | 862 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); |
| 863 case GrDashingEffect::kNonRound_DashCap: | 863 case GrDashingEffect::kNonRound_DashCap: |
| 864 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 864 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
| 865 default: | 865 default: |
| 866 SkFAIL("Unexpected dashed cap."); | 866 SkFAIL("Unexpected dashed cap."); |
| 867 } | 867 } |
| 868 return NULL; | 868 return NULL; |
| 869 } | 869 } |
| OLD | NEW |