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

Side by Side Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 2248323003: Simplify adding attributes to GrGeometryProcessor (Closed) Base URL: https://chromium.googlesource.com/skia.git@xformhelper
Patch Set: Revert removal of fAttribNames Created 4 years, 4 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 | « no previous file | src/gpu/GrGeometryProcessor.h » ('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 "GrDefaultGeoProcFactory.h" 8 #include "GrDefaultGeoProcFactory.h"
9 9
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 , fCoverage(coverage) 227 , fCoverage(coverage)
228 , fFlags(gpTypeFlags) 228 , fFlags(gpTypeFlags)
229 , fLocalCoordsWillBeRead(localCoordsWillBeRead) 229 , fLocalCoordsWillBeRead(localCoordsWillBeRead)
230 , fCoverageWillBeIgnored(coverageWillBeIgnored) { 230 , fCoverageWillBeIgnored(coverageWillBeIgnored) {
231 this->initClassID<DefaultGeoProc>(); 231 this->initClassID<DefaultGeoProc>();
232 bool hasColor = SkToBool(gpTypeFlags & kColor_GPFlag); 232 bool hasColor = SkToBool(gpTypeFlags & kColor_GPFlag);
233 bool hasExplicitLocalCoords = SkToBool(gpTypeFlags & kLocalCoord_GPFlag) ; 233 bool hasExplicitLocalCoords = SkToBool(gpTypeFlags & kLocalCoord_GPFlag) ;
234 bool hasTransformedLocalCoords = SkToBool(gpTypeFlags & kTransformedLoca lCoord_GPFlag); 234 bool hasTransformedLocalCoords = SkToBool(gpTypeFlags & kTransformedLoca lCoord_GPFlag);
235 bool hasLocalCoord = hasExplicitLocalCoords || hasTransformedLocalCoords ; 235 bool hasLocalCoord = hasExplicitLocalCoords || hasTransformedLocalCoords ;
236 bool hasCoverage = SkToBool(gpTypeFlags & kCoverage_GPFlag); 236 bool hasCoverage = SkToBool(gpTypeFlags & kCoverage_GPFlag);
237 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, 237 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttrib Type,
238 kHigh_GrSLPrecision)); 238 kHigh_GrSLPrecision);
239 if (hasColor) { 239 if (hasColor) {
240 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVer texAttribType)); 240 fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribT ype);
241 } 241 }
242 if (hasLocalCoord) { 242 if (hasLocalCoord) {
243 fInLocalCoords = &this->addVertexAttrib(Attribute("inLocalCoord", 243 fInLocalCoords = &this->addVertexAttrib("inLocalCoord", kVec2f_GrVer texAttribType);
244 kVec2f_GrVertexAtt ribType));
245 if (hasExplicitLocalCoords) { 244 if (hasExplicitLocalCoords) {
246 this->setHasExplicitLocalCoords(); 245 this->setHasExplicitLocalCoords();
247 } else { 246 } else {
248 SkASSERT(hasTransformedLocalCoords); 247 SkASSERT(hasTransformedLocalCoords);
249 this->setHasTransformedLocalCoords(); 248 this->setHasTransformedLocalCoords();
250 } 249 }
251 } 250 }
252 if (hasCoverage) { 251 if (hasCoverage) {
253 fInCoverage = &this->addVertexAttrib(Attribute("inCoverage", 252 fInCoverage = &this->addVertexAttrib("inCoverage", kFloat_GrVertexAt tribType);
254 kFloat_GrVertexAttrib Type));
255 } 253 }
256 } 254 }
257 255
258 const Attribute* fInPosition; 256 const Attribute* fInPosition;
259 const Attribute* fInColor; 257 const Attribute* fInColor;
260 const Attribute* fInLocalCoords; 258 const Attribute* fInLocalCoords;
261 const Attribute* fInCoverage; 259 const Attribute* fInCoverage;
262 GrColor fColor; 260 GrColor fColor;
263 SkMatrix fViewMatrix; 261 SkMatrix fViewMatrix;
264 SkMatrix fLocalMatrix; 262 SkMatrix fLocalMatrix;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 335 }
338 336
339 if (localCoords.hasLocalMatrix()) { 337 if (localCoords.hasLocalMatrix()) {
340 invert.preConcat(*localCoords.fMatrix); 338 invert.preConcat(*localCoords.fMatrix);
341 } 339 }
342 } 340 }
343 341
344 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); 342 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert);
345 return Make(color, coverage, inverted, SkMatrix::I()); 343 return Make(color, coverage, inverted, SkMatrix::I());
346 } 344 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698