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

Side by Side Diff: src/gpu/effects/GrBezierEffect.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 | « src/gpu/batches/GrPLSPathRenderer.cpp ('k') | src/gpu/effects/GrBitmapTextGeoProc.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 2013 Google Inc. 2 * Copyright 2013 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 "GrBezierEffect.h" 8 #include "GrBezierEffect.h"
9 9
10 #include "glsl/GrGLSLFragmentShaderBuilder.h" 10 #include "glsl/GrGLSLFragmentShaderBuilder.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage, 256 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
257 GrPrimitiveEdgeType edgeType, const SkMatrix& local Matrix, 257 GrPrimitiveEdgeType edgeType, const SkMatrix& local Matrix,
258 bool usesLocalCoords) 258 bool usesLocalCoords)
259 : fColor(color) 259 : fColor(color)
260 , fViewMatrix(viewMatrix) 260 , fViewMatrix(viewMatrix)
261 , fLocalMatrix(viewMatrix) 261 , fLocalMatrix(viewMatrix)
262 , fUsesLocalCoords(usesLocalCoords) 262 , fUsesLocalCoords(usesLocalCoords)
263 , fCoverageScale(coverage) 263 , fCoverageScale(coverage)
264 , fEdgeType(edgeType) { 264 , fEdgeType(edgeType) {
265 this->initClassID<GrConicEffect>(); 265 this->initClassID<GrConicEffect>();
266 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType, 266 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType ,
267 kHigh_GrSLPrecision)); 267 kHigh_GrSLPrecision);
268 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", 268 fInConicCoeffs = &this->addVertexAttrib("inConicCoeffs", kVec4f_GrVertexAttr ibType);
269 kVec4f_GrVertexAttribType) );
270 } 269 }
271 270
272 ////////////////////////////////////////////////////////////////////////////// 271 //////////////////////////////////////////////////////////////////////////////
273 272
274 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); 273 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect);
275 274
276 sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) { 275 sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) {
277 sk_sp<GrGeometryProcessor> gp; 276 sk_sp<GrGeometryProcessor> gp;
278 do { 277 do {
279 GrPrimitiveEdgeType edgeType = 278 GrPrimitiveEdgeType edgeType =
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co verage, 472 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co verage,
474 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa trix, 473 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa trix,
475 bool usesLocalCoords) 474 bool usesLocalCoords)
476 : fColor(color) 475 : fColor(color)
477 , fViewMatrix(viewMatrix) 476 , fViewMatrix(viewMatrix)
478 , fLocalMatrix(localMatrix) 477 , fLocalMatrix(localMatrix)
479 , fUsesLocalCoords(usesLocalCoords) 478 , fUsesLocalCoords(usesLocalCoords)
480 , fCoverageScale(coverage) 479 , fCoverageScale(coverage)
481 , fEdgeType(edgeType) { 480 , fEdgeType(edgeType) {
482 this->initClassID<GrQuadEffect>(); 481 this->initClassID<GrQuadEffect>();
483 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType, 482 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType ,
484 kHigh_GrSLPrecision)); 483 kHigh_GrSLPrecision);
485 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", 484 fInHairQuadEdge = &this->addVertexAttrib("inHairQuadEdge", kVec4f_GrVertexAt tribType);
486 kVec4f_GrVertexAttribTyp e));
487 } 485 }
488 486
489 ////////////////////////////////////////////////////////////////////////////// 487 //////////////////////////////////////////////////////////////////////////////
490 488
491 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); 489 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect);
492 490
493 sk_sp<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) { 491 sk_sp<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) {
494 sk_sp<GrGeometryProcessor> gp; 492 sk_sp<GrGeometryProcessor> gp;
495 do { 493 do {
496 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 494 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 GrGLSLPrimitiveProcessor* GrCubicEffect::createGLSLInstance(const GrGLSLCaps&) c onst { 699 GrGLSLPrimitiveProcessor* GrCubicEffect::createGLSLInstance(const GrGLSLCaps&) c onst {
702 return new GrGLCubicEffect(*this); 700 return new GrGLCubicEffect(*this);
703 } 701 }
704 702
705 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, 703 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix,
706 GrPrimitiveEdgeType edgeType) 704 GrPrimitiveEdgeType edgeType)
707 : fColor(color) 705 : fColor(color)
708 , fViewMatrix(viewMatrix) 706 , fViewMatrix(viewMatrix)
709 , fEdgeType(edgeType) { 707 , fEdgeType(edgeType) {
710 this->initClassID<GrCubicEffect>(); 708 this->initClassID<GrCubicEffect>();
711 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex AttribType, 709 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType ,
712 kHigh_GrSLPrecision)); 710 kHigh_GrSLPrecision);
713 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", 711 fInCubicCoeffs = &this->addVertexAttrib("inCubicCoeffs", kVec4f_GrVertexAttr ibType);
714 kVec4f_GrVertexAttribTyp e));
715 } 712 }
716 713
717 ////////////////////////////////////////////////////////////////////////////// 714 //////////////////////////////////////////////////////////////////////////////
718 715
719 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); 716 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect);
720 717
721 sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) { 718 sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) {
722 sk_sp<GrGeometryProcessor> gp; 719 sk_sp<GrGeometryProcessor> gp;
723 do { 720 do {
724 GrPrimitiveEdgeType edgeType = 721 GrPrimitiveEdgeType edgeType =
725 static_cast<GrPrimitiveEdgeType>( 722 static_cast<GrPrimitiveEdgeType>(
726 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); 723 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
727 gp = GrCubicEffect::Make(GrRandomColor(d->fRandom), 724 gp = GrCubicEffect::Make(GrRandomColor(d->fRandom),
728 GrTest::TestMatrix(d->fRandom), edgeType, *d->f Caps); 725 GrTest::TestMatrix(d->fRandom), edgeType, *d->f Caps);
729 } while (nullptr == gp); 726 } while (nullptr == gp);
730 return gp; 727 return gp;
731 } 728 }
OLDNEW
« no previous file with comments | « src/gpu/batches/GrPLSPathRenderer.cpp ('k') | src/gpu/effects/GrBitmapTextGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698