OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrGLSL.h" | 8 #include "GrGLSL.h" |
9 #include "GrGLShaderVar.h" | 9 #include "GrGLShaderVar.h" |
10 #include "SkString.h" | 10 #include "SkString.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 int cnt = GrMin((int)GR_ARRAY_COUNT(kTabs), tabCnt); | 70 int cnt = GrMin((int)GR_ARRAY_COUNT(kTabs), tabCnt); |
71 outAppend->append(kTabs, cnt); | 71 outAppend->append(kTabs, cnt); |
72 tabCnt -= cnt; | 72 tabCnt -= cnt; |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void GrGLSLMulVarBy4f(SkString* outAppend, | 77 void GrGLSLMulVarBy4f(SkString* outAppend, |
78 unsigned tabCnt, | 78 unsigned tabCnt, |
79 const char* vec4VarName, | 79 const char* vec4VarName, |
80 const GrGLSLExpr<4>& mulFactor) { | 80 const GrGLSLExpr4& mulFactor) { |
81 if (mulFactor.isOnes()) { | 81 if (mulFactor.isOnes()) { |
82 *outAppend = SkString(); | 82 *outAppend = SkString(); |
83 } | 83 } |
84 | 84 |
85 append_tabs(outAppend, tabCnt); | 85 append_tabs(outAppend, tabCnt); |
86 | 86 |
87 if (mulFactor.isZeros()) { | 87 if (mulFactor.isZeros()) { |
88 outAppend->appendf("%s = vec4(0);\n", vec4VarName); | 88 outAppend->appendf("%s = vec4(0);\n", vec4VarName); |
89 } | 89 } |
90 outAppend->appendf("%s *= %s;\n", vec4VarName, mulFactor.c_str()); | 90 outAppend->appendf("%s *= %s;\n", vec4VarName, mulFactor.c_str()); |
91 } | 91 } |
OLD | NEW |