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

Side by Side Diff: src/gpu/glsl/GrGLSLGeometryProcessor.cpp

Issue 1682083002: Remove SkNEW_APPEND_TO_TARRAY. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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/builders/GrGLProgramBuilder.cpp ('k') | tests/TextBlobCacheTest.cpp » ('j') | 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 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 "GrGLSLGeometryProcessor.h" 8 #include "GrGLSLGeometryProcessor.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 strUniName.c_str(), 55 strUniName.c_str(),
56 &uniName).toIndex(); 56 &uniName).toIndex();
57 57
58 SkString strVaryingName("MatrixCoord"); 58 SkString strVaryingName("MatrixCoord");
59 strVaryingName.appendf("_%i_%i", i, t); 59 strVaryingName.appendf("_%i_%i", i, t);
60 60
61 GrGLSLVertToFrag v(varyingType); 61 GrGLSLVertToFrag v(varyingType);
62 varyingHandler->addVarying(strVaryingName.c_str(), &v, precision); 62 varyingHandler->addVarying(strVaryingName.c_str(), &v, precision);
63 63
64 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyin gType); 64 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyin gType);
65 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLSLTransformedCoords, 65 (*tout)[i].emplace_back(SkString(v.fsIn()), varyingType);
66 (SkString(v.fsIn()), varyingType));
67 66
68 // varying = matrix * coords (logically) 67 // varying = matrix * coords (logically)
69 if (kDevice_GrCoordSet == coordType) { 68 if (kDevice_GrCoordSet == coordType) {
70 if (kVec2f_GrSLType == varyingType) { 69 if (kVec2f_GrSLType == varyingType) {
71 if (kVec2f_GrSLType == posVar.getType()) { 70 if (kVec2f_GrSLType == posVar.getType()) {
72 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", 71 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;",
73 v.vsOut(), uniName, posVar.c_str()); 72 v.vsOut(), uniName, posVar.c_str());
74 } else { 73 } else {
75 // The brackets here are just to scope the temp variable 74 // The brackets here are just to scope the temp variable
76 vb->codeAppendf("{ vec3 temp = %s * %s;", uniName, posVa r.c_str()); 75 vb->codeAppendf("{ vec3 temp = %s * %s;", uniName, posVa r.c_str());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 SkASSERT(kDevice_GrCoordSet != coordTransforms[t]->sourceCoords()); 109 SkASSERT(kDevice_GrCoordSet != coordTransforms[t]->sourceCoords());
111 GrSLPrecision precision = coordTransforms[t]->precision(); 110 GrSLPrecision precision = coordTransforms[t]->precision();
112 111
113 SkString strVaryingName("MatrixCoord"); 112 SkString strVaryingName("MatrixCoord");
114 strVaryingName.appendf("_%i_%i", i, t); 113 strVaryingName.appendf("_%i_%i", i, t);
115 114
116 GrGLSLVertToFrag v(varyingType); 115 GrGLSLVertToFrag v(varyingType);
117 varyingHandler->addVarying(strVaryingName.c_str(), &v, precision); 116 varyingHandler->addVarying(strVaryingName.c_str(), &v, precision);
118 vb->codeAppendf("%s = %s;", v.vsOut(), localCoords); 117 vb->codeAppendf("%s = %s;", v.vsOut(), localCoords);
119 118
120 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], 119 (*tout)[i].emplace_back(SkString(v.fsIn()), varyingType);
121 GrGLSLTransformedCoords,
122 (SkString(v.fsIn()), varyingType));
123 } 120 }
124 } 121 }
125 } 122 }
126 123
127 void GrGLSLGeometryProcessor::setupPosition(GrGLSLVertexBuilder* vertBuilder, 124 void GrGLSLGeometryProcessor::setupPosition(GrGLSLVertexBuilder* vertBuilder,
128 GrGPArgs* gpArgs, 125 GrGPArgs* gpArgs,
129 const char* posName) { 126 const char* posName) {
130 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); 127 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
131 vertBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posN ame); 128 vertBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posN ame);
132 } 129 }
(...skipping 17 matching lines...) Expand all
150 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); 147 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
151 vertBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));", 148 vertBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
152 gpArgs->fPositionVar.c_str(), viewMatrixNam e, posName); 149 gpArgs->fPositionVar.c_str(), viewMatrixNam e, posName);
153 } else { 150 } else {
154 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3"); 151 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
155 vertBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);", 152 vertBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
156 gpArgs->fPositionVar.c_str(), viewMatrixNam e, posName); 153 gpArgs->fPositionVar.c_str(), viewMatrixNam e, posName);
157 } 154 }
158 } 155 }
159 } 156 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | tests/TextBlobCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698