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

Side by Side Diff: src/gpu/effects/GrCustomCoordsTextureEffect.cpp

Issue 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: todo added Created 6 years 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
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 "GrCustomCoordsTextureEffect.h" 8 #include "GrCustomCoordsTextureEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 b->add32(SkToBool(gp.inColor())); 60 b->add32(SkToBool(gp.inColor()));
61 } 61 }
62 62
63 63
64 private: 64 private:
65 typedef GrGLGeometryProcessor INHERITED; 65 typedef GrGLGeometryProcessor INHERITED;
66 }; 66 };
67 67
68 /////////////////////////////////////////////////////////////////////////////// 68 ///////////////////////////////////////////////////////////////////////////////
69 69
70 GrCustomCoordsTextureEffect::GrCustomCoordsTextureEffect(GrTexture* texture, 70 GrCustomCoordsTextureEffect::GrCustomCoordsTextureEffect(GrColor color,
71 GrTexture* texture,
71 const GrTextureParams& params, 72 const GrTextureParams& params,
72 bool hasColor) 73 bool hasColor)
73 : fTextureAccess(texture, params), fInColor(NULL) { 74 : INHERITED(color), fTextureAccess(texture, params), fInColor(NULL) {
74 this->initClassID<GrCustomCoordsTextureEffect>(); 75 this->initClassID<GrCustomCoordsTextureEffect>();
75 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert exAttribType)); 76 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert exAttribType));
76 if (hasColor) { 77 if (hasColor) {
77 fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVerte xAttribType)); 78 fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVerte xAttribType));
78 this->setHasVertexColor(); 79 this->setHasVertexColor();
79 } 80 }
80 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords", 81 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords",
81 kVec2f_GrVertexAttribT ype)); 82 kVec2f_GrVertexAttribT ype));
82 this->addTextureAccess(&fTextureAccess); 83 this->addTextureAccess(&fTextureAccess);
83 } 84 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 SkShader::kRepeat_TileMode, 123 SkShader::kRepeat_TileMode,
123 SkShader::kMirror_TileMode, 124 SkShader::kMirror_TileMode,
124 }; 125 };
125 SkShader::TileMode tileModes[] = { 126 SkShader::TileMode tileModes[] = {
126 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 127 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
127 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 128 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
128 }; 129 };
129 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode : 130 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode :
130 GrTextureParams::kNon e_FilterMode); 131 GrTextureParams::kNon e_FilterMode);
131 132
132 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params, random- >nextBool()); 133 return GrCustomCoordsTextureEffect::Create(GrRandomColor(random), textures[t exIdx], params, random->nextBool());
133 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698