OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkTwoPointConicalGradient_gpu.h" | 9 #include "SkTwoPointConicalGradient_gpu.h" |
10 | 10 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 SkString tName("t"); | 233 SkString tName("t"); |
234 SkString p0; // start radius | 234 SkString p0; // start radius |
235 SkString p1; // start radius squared | 235 SkString p1; // start radius squared |
236 SkString p2; // difference in radii (r1 - r0) | 236 SkString p2; // difference in radii (r1 - r0) |
237 | 237 |
238 builder->getUniformVariable(fParamUni).appendArrayAccess(0, &p0); | 238 builder->getUniformVariable(fParamUni).appendArrayAccess(0, &p0); |
239 builder->getUniformVariable(fParamUni).appendArrayAccess(1, &p1); | 239 builder->getUniformVariable(fParamUni).appendArrayAccess(1, &p1); |
240 builder->getUniformVariable(fParamUni).appendArrayAccess(2, &p2); | 240 builder->getUniformVariable(fParamUni).appendArrayAccess(2, &p2); |
241 | 241 |
242 // We interpolate the linear component in coords[1]. | 242 // We interpolate the linear component in coords[1]. |
243 SkASSERT(coords[0].type() == coords[1].type()); | 243 SkASSERT(coords[0].getType() == coords[1].getType()); |
244 const char* coords2D; | 244 const char* coords2D; |
245 SkString bVar; | 245 SkString bVar; |
246 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 246 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
247 if (kVec3f_GrSLType == coords[0].type()) { | 247 if (kVec3f_GrSLType == coords[0].getType()) { |
248 fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy / %s.z, %s.x /
%s.z);\n", | 248 fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy / %s.z, %s.x /
%s.z);\n", |
249 coords[0].c_str(), coords[0].c_str(), coords[1].c
_str(), | 249 coords[0].c_str(), coords[0].c_str(), coords[1].c
_str(), |
250 coords[1].c_str()); | 250 coords[1].c_str()); |
251 coords2D = "interpolants.xy"; | 251 coords2D = "interpolants.xy"; |
252 bVar = "interpolants.z"; | 252 bVar = "interpolants.z"; |
253 } else { | 253 } else { |
254 coords2D = coords[0].c_str(); | 254 coords2D = coords[0].c_str(); |
255 bVar.printf("%s.x", coords[1].c_str()); | 255 bVar.printf("%s.x", coords[1].c_str()); |
256 } | 256 } |
257 | 257 |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); | 1317 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); |
1318 } else if (type == kEdge_ConicalType) { | 1318 } else if (type == kEdge_ConicalType) { |
1319 set_matrix_edge_conical(shader, &matrix); | 1319 set_matrix_edge_conical(shader, &matrix); |
1320 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); | 1320 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); |
1321 } else { | 1321 } else { |
1322 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); | 1322 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); |
1323 } | 1323 } |
1324 } | 1324 } |
1325 | 1325 |
1326 #endif | 1326 #endif |
OLD | NEW |