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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 vsBuilder->codeAppendf("%s = %s;", dashParams.vsOut(), dce.inDashParams()->f
Name); | 638 vsBuilder->codeAppendf("%s = %s;", dashParams.vsOut(), dce.inDashParams()->f
Name); |
639 | 639 |
640 // xy, refer to circle radius - 0.5, z refers to cicles center x coord | 640 // xy, refer to circle radius - 0.5, z refers to cicles center x coord |
641 GrGLVertToFrag circleParams(kVec2f_GrSLType); | 641 GrGLVertToFrag circleParams(kVec2f_GrSLType); |
642 args.fPB->addVarying("CircleParams", &circleParams); | 642 args.fPB->addVarying("CircleParams", &circleParams); |
643 vsBuilder->codeAppendf("%s = %s;", circleParams.vsOut(), dce.inCircleParams(
)->fName); | 643 vsBuilder->codeAppendf("%s = %s;", circleParams.vsOut(), dce.inCircleParams(
)->fName); |
644 | 644 |
645 // Setup pass through color | 645 // Setup pass through color |
646 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, NU
LL, &fColorUniform); | 646 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, NU
LL, &fColorUniform); |
647 | 647 |
648 // setup uniform viewMatrix | |
649 this->addUniformViewMatrix(pb); | |
650 | |
651 // Setup position | 648 // Setup position |
652 SetupPosition(vsBuilder, gpArgs, dce.inPosition()->fName, dce.viewMatrix(),
this->uViewM()); | 649 this->setupPosition(pb, gpArgs, dce.inPosition()->fName, dce.viewMatrix()); |
653 | 650 |
654 // emit transforms | 651 // emit transforms |
655 this->emitTransforms(args.fPB, gpArgs->fPositionVar, dce.inPosition()->fName
, dce.localMatrix(), | 652 this->emitTransforms(args.fPB, gpArgs->fPositionVar, dce.inPosition()->fName
, dce.localMatrix(), |
656 args.fTransformsIn, args.fTransformsOut); | 653 args.fTransformsIn, args.fTransformsOut); |
657 | 654 |
658 // transforms all points so that we can compare them to our test circle | 655 // transforms all points so that we can compare them to our test circle |
659 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); | 656 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); |
660 fsBuilder->codeAppendf("float xShifted = %s.x - floor(%s.x / %s.z) * %s.z;", | 657 fsBuilder->codeAppendf("float xShifted = %s.x - floor(%s.x / %s.z) * %s.z;", |
661 dashParams.fsIn(), dashParams.fsIn(), dashParams.fsIn
(), | 658 dashParams.fsIn(), dashParams.fsIn(), dashParams.fsIn
(), |
662 dashParams.fsIn()); | 659 dashParams.fsIn()); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 | 882 |
886 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), | 883 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), |
887 // respectively. | 884 // respectively. |
888 GrGLVertToFrag inRectParams(kVec4f_GrSLType); | 885 GrGLVertToFrag inRectParams(kVec4f_GrSLType); |
889 args.fPB->addVarying("RectParams", &inRectParams); | 886 args.fPB->addVarying("RectParams", &inRectParams); |
890 vsBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()->
fName); | 887 vsBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()->
fName); |
891 | 888 |
892 // Setup pass through color | 889 // Setup pass through color |
893 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, NU
LL, &fColorUniform); | 890 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, NU
LL, &fColorUniform); |
894 | 891 |
895 // setup uniform viewMatrix | |
896 this->addUniformViewMatrix(pb); | |
897 | |
898 // Setup position | 892 // Setup position |
899 SetupPosition(vsBuilder, gpArgs, de.inPosition()->fName, de.viewMatrix(), th
is->uViewM()); | 893 this->setupPosition(pb, gpArgs, de.inPosition()->fName, de.viewMatrix()); |
900 | 894 |
901 // emit transforms | 895 // emit transforms |
902 this->emitTransforms(args.fPB, gpArgs->fPositionVar, de.inPosition()->fName,
de.localMatrix(), | 896 this->emitTransforms(args.fPB, gpArgs->fPositionVar, de.inPosition()->fName,
de.localMatrix(), |
903 args.fTransformsIn, args.fTransformsOut); | 897 args.fTransformsIn, args.fTransformsOut); |
904 | 898 |
905 // transforms all points so that we can compare them to our test rect | 899 // transforms all points so that we can compare them to our test rect |
906 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); | 900 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); |
907 fsBuilder->codeAppendf("float xShifted = %s.x - floor(%s.x / %s.z) * %s.z;", | 901 fsBuilder->codeAppendf("float xShifted = %s.x - floor(%s.x / %s.z) * %s.z;", |
908 inDashParams.fsIn(), inDashParams.fsIn(), inDashParam
s.fsIn(), | 902 inDashParams.fsIn(), inDashParams.fsIn(), inDashParam
s.fsIn(), |
909 inDashParams.fsIn()); | 903 inDashParams.fsIn()); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 switch (cap) { | 1030 switch (cap) { |
1037 case kRound_DashCap: | 1031 case kRound_DashCap: |
1038 return DashingCircleEffect::Create(color, edgeType, localMatrix); | 1032 return DashingCircleEffect::Create(color, edgeType, localMatrix); |
1039 case kNonRound_DashCap: | 1033 case kNonRound_DashCap: |
1040 return DashingLineEffect::Create(color, edgeType, localMatrix); | 1034 return DashingLineEffect::Create(color, edgeType, localMatrix); |
1041 default: | 1035 default: |
1042 SkFAIL("Unexpected dashed cap."); | 1036 SkFAIL("Unexpected dashed cap."); |
1043 } | 1037 } |
1044 return NULL; | 1038 return NULL; |
1045 } | 1039 } |
OLD | NEW |