Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: src/gpu/gl/GrGLSL.cpp

Issue 648463002: Remove tab parameter from GrGLSLMulVarBy4f function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLSL.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return "#version 150\n"; 62 return "#version 150\n";
63 } else { 63 } else {
64 return "#version 150 compatibility\n"; 64 return "#version 150 compatibility\n";
65 } 65 }
66 default: 66 default:
67 SkFAIL("Unknown GL version."); 67 SkFAIL("Unknown GL version.");
68 return ""; // suppress warning 68 return ""; // suppress warning
69 } 69 }
70 } 70 }
71 71
72 namespace { 72 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor) {
73 void append_tabs(SkString* outAppend, int tabCnt) {
74 static const char kTabs[] = "\t\t\t\t\t\t\t\t";
75 while (tabCnt) {
76 int cnt = SkTMin((int)SK_ARRAY_COUNT(kTabs), tabCnt);
77 outAppend->append(kTabs, cnt);
78 tabCnt -= cnt;
79 }
80 }
81 }
82
83 void GrGLSLMulVarBy4f(SkString* outAppend,
84 unsigned tabCnt,
85 const char* vec4VarName,
86 const GrGLSLExpr4& mulFactor) {
87 if (mulFactor.isOnes()) { 73 if (mulFactor.isOnes()) {
88 *outAppend = SkString(); 74 *outAppend = SkString();
89 } 75 }
90 76
91 append_tabs(outAppend, tabCnt);
92
93 if (mulFactor.isZeros()) { 77 if (mulFactor.isZeros()) {
94 outAppend->appendf("%s = vec4(0);\n", vec4VarName); 78 outAppend->appendf("%s = vec4(0);", vec4VarName);
95 } else { 79 } else {
96 outAppend->appendf("%s *= %s;\n", vec4VarName, mulFactor.c_str()); 80 outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str());
97 } 81 }
98 } 82 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLSL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698