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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 // XY are dashPos, Z is dashInterval | 872 // XY are dashPos, Z is dashInterval |
873 GrGLSLVertToFrag dashParams(kVec3f_GrSLType); | 873 GrGLSLVertToFrag dashParams(kVec3f_GrSLType); |
874 varyingHandler->addVarying("DashParam", &dashParams); | 874 varyingHandler->addVarying("DashParam", &dashParams); |
875 vertBuilder->codeAppendf("%s = %s;", dashParams.vsOut(), dce.inDashParams()-
>fName); | 875 vertBuilder->codeAppendf("%s = %s;", dashParams.vsOut(), dce.inDashParams()-
>fName); |
876 | 876 |
877 // x refers to circle radius - 0.5, y refers to cicle's center x coord | 877 // x refers to circle radius - 0.5, y refers to cicle's center x coord |
878 GrGLSLVertToFrag circleParams(kVec2f_GrSLType); | 878 GrGLSLVertToFrag circleParams(kVec2f_GrSLType); |
879 varyingHandler->addVarying("CircleParams", &circleParams); | 879 varyingHandler->addVarying("CircleParams", &circleParams); |
880 vertBuilder->codeAppendf("%s = %s;", circleParams.vsOut(), dce.inCircleParam
s()->fName); | 880 vertBuilder->codeAppendf("%s = %s;", circleParams.vsOut(), dce.inCircleParam
s()->fName); |
881 | 881 |
882 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 882 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder; |
883 // Setup pass through color | 883 // Setup pass through color |
884 if (!dce.colorIgnored()) { | 884 if (!dce.colorIgnored()) { |
885 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
&fColorUniform); | 885 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
&fColorUniform); |
886 } | 886 } |
887 | 887 |
888 // Setup position | 888 // Setup position |
889 this->setupPosition(vertBuilder, gpArgs, dce.inPosition()->fName); | 889 this->setupPosition(vertBuilder, gpArgs, dce.inPosition()->fName); |
890 | 890 |
891 // emit transforms | 891 // emit transforms |
892 this->emitTransforms(vertBuilder, | 892 this->emitTransforms(vertBuilder, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 GrGLSLVertToFrag inDashParams(kVec3f_GrSLType); | 1086 GrGLSLVertToFrag inDashParams(kVec3f_GrSLType); |
1087 varyingHandler->addVarying("DashParams", &inDashParams, GrSLPrecision::kHigh
_GrSLPrecision); | 1087 varyingHandler->addVarying("DashParams", &inDashParams, GrSLPrecision::kHigh
_GrSLPrecision); |
1088 vertBuilder->codeAppendf("%s = %s;", inDashParams.vsOut(), de.inDashParams()
->fName); | 1088 vertBuilder->codeAppendf("%s = %s;", inDashParams.vsOut(), de.inDashParams()
->fName); |
1089 | 1089 |
1090 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), | 1090 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot
tom - 0.5), |
1091 // respectively. | 1091 // respectively. |
1092 GrGLSLVertToFrag inRectParams(kVec4f_GrSLType); | 1092 GrGLSLVertToFrag inRectParams(kVec4f_GrSLType); |
1093 varyingHandler->addVarying("RectParams", &inRectParams, GrSLPrecision::kHigh
_GrSLPrecision); | 1093 varyingHandler->addVarying("RectParams", &inRectParams, GrSLPrecision::kHigh
_GrSLPrecision); |
1094 vertBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()
->fName); | 1094 vertBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()
->fName); |
1095 | 1095 |
1096 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 1096 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder; |
1097 // Setup pass through color | 1097 // Setup pass through color |
1098 if (!de.colorIgnored()) { | 1098 if (!de.colorIgnored()) { |
1099 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
&fColorUniform); | 1099 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
&fColorUniform); |
1100 } | 1100 } |
1101 | 1101 |
1102 // Setup position | 1102 // Setup position |
1103 this->setupPosition(vertBuilder, gpArgs, de.inPosition()->fName); | 1103 this->setupPosition(vertBuilder, gpArgs, de.inPosition()->fName); |
1104 | 1104 |
1105 // emit transforms | 1105 // emit transforms |
1106 this->emitTransforms(vertBuilder, | 1106 this->emitTransforms(vertBuilder, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 info.fIntervals = intervals; | 1306 info.fIntervals = intervals; |
1307 info.fCount = 2; | 1307 info.fCount = 2; |
1308 info.fPhase = phase; | 1308 info.fPhase = phase; |
1309 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); | 1309 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); |
1310 SkASSERT(success); | 1310 SkASSERT(success); |
1311 | 1311 |
1312 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); | 1312 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); |
1313 } | 1313 } |
1314 | 1314 |
1315 #endif | 1315 #endif |
OLD | NEW |