OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 "SkTwoPointRadialGradient.h" | 9 #include "SkTwoPointRadialGradient.h" |
10 | 10 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 SkString p5; | 591 SkString p5; |
592 builder->getUniformVariable(fParamUni).appendArrayAccess(0, &p0); | 592 builder->getUniformVariable(fParamUni).appendArrayAccess(0, &p0); |
593 builder->getUniformVariable(fParamUni).appendArrayAccess(1, &p1); | 593 builder->getUniformVariable(fParamUni).appendArrayAccess(1, &p1); |
594 builder->getUniformVariable(fParamUni).appendArrayAccess(2, &p2); | 594 builder->getUniformVariable(fParamUni).appendArrayAccess(2, &p2); |
595 builder->getUniformVariable(fParamUni).appendArrayAccess(3, &p3); | 595 builder->getUniformVariable(fParamUni).appendArrayAccess(3, &p3); |
596 builder->getUniformVariable(fParamUni).appendArrayAccess(4, &p4); | 596 builder->getUniformVariable(fParamUni).appendArrayAccess(4, &p4); |
597 builder->getUniformVariable(fParamUni).appendArrayAccess(5, &p5); | 597 builder->getUniformVariable(fParamUni).appendArrayAccess(5, &p5); |
598 | 598 |
599 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 599 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
600 // We interpolate the linear component in coords[1]. | 600 // We interpolate the linear component in coords[1]. |
601 SkASSERT(coords[0].type() == coords[1].type()); | 601 SkASSERT(coords[0].getType() == coords[1].getType()); |
602 const char* coords2D; | 602 const char* coords2D; |
603 SkString bVar; | 603 SkString bVar; |
604 if (kVec3f_GrSLType == coords[0].type()) { | 604 if (kVec3f_GrSLType == coords[0].getType()) { |
605 fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy, %s.x) / %s.z;\
n", | 605 fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy, %s.x) / %s.z;\
n", |
606 coords[0].c_str(), coords[1].c_str(), coords[0].c
_str()); | 606 coords[0].c_str(), coords[1].c_str(), coords[0].c
_str()); |
607 coords2D = "interpolants.xy"; | 607 coords2D = "interpolants.xy"; |
608 bVar = "interpolants.z"; | 608 bVar = "interpolants.z"; |
609 } else { | 609 } else { |
610 coords2D = coords[0].c_str(); | 610 coords2D = coords[0].c_str(); |
611 bVar.printf("%s.x", coords[1].c_str()); | 611 bVar.printf("%s.x", coords[1].c_str()); |
612 } | 612 } |
613 | 613 |
614 // c = (x^2)+(y^2) - params[4] | 614 // c = (x^2)+(y^2) - params[4] |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 #else | 721 #else |
722 | 722 |
723 bool SkTwoPointRadialGradient::asNewEffect(GrContext* context, const SkPaint& pa
int, | 723 bool SkTwoPointRadialGradient::asNewEffect(GrContext* context, const SkPaint& pa
int, |
724 const SkMatrix* localMatrix, GrColor*
paintColor, | 724 const SkMatrix* localMatrix, GrColor*
paintColor, |
725 GrEffect** effect) const { | 725 GrEffect** effect) const { |
726 SkDEBUGFAIL("Should not call in GPU-less build"); | 726 SkDEBUGFAIL("Should not call in GPU-less build"); |
727 return false; | 727 return false; |
728 } | 728 } |
729 | 729 |
730 #endif | 730 #endif |
OLD | NEW |