OLD | NEW |
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 "GrBitmapTextGeoProc.h" | 8 #include "GrBitmapTextGeoProc.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 b->add32(SkToBool(gp.inColor())); | 58 b->add32(SkToBool(gp.inColor())); |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 private: | 62 private: |
63 typedef GrGLGeometryProcessor INHERITED; | 63 typedef GrGLGeometryProcessor INHERITED; |
64 }; | 64 }; |
65 | 65 |
66 /////////////////////////////////////////////////////////////////////////////// | 66 /////////////////////////////////////////////////////////////////////////////// |
67 | 67 |
68 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrTexture* texture, const GrTexturePara
ms& params, | 68 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, |
69 bool useColorAttrib) | 69 const GrTextureParams& params, bool use
ColorAttrib) |
70 : fTextureAccess(texture, params), fInColor(NULL) { | 70 : INHERITED(color), fTextureAccess(texture, params), fInColor(NULL) { |
71 this->initClassID<GrBitmapTextGeoProc>(); | 71 this->initClassID<GrBitmapTextGeoProc>(); |
72 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 72 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); |
73 if (useColorAttrib) { | 73 if (useColorAttrib) { |
74 fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVerte
xAttribType)); | 74 fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVerte
xAttribType)); |
75 this->setHasVertexColor(); | 75 this->setHasVertexColor(); |
76 } | 76 } |
77 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords", | 77 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords", |
78 kVec2f_GrVertexAttribT
ype)); | 78 kVec2f_GrVertexAttribT
ype)); |
79 this->addTextureAccess(&fTextureAccess); | 79 this->addTextureAccess(&fTextureAccess); |
80 } | 80 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 SkShader::kRepeat_TileMode, | 121 SkShader::kRepeat_TileMode, |
122 SkShader::kMirror_TileMode, | 122 SkShader::kMirror_TileMode, |
123 }; | 123 }; |
124 SkShader::TileMode tileModes[] = { | 124 SkShader::TileMode tileModes[] = { |
125 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 125 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
126 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 126 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
127 }; | 127 }; |
128 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 128 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
129 GrTextureParams::kNon
e_FilterMode); | 129 GrTextureParams::kNon
e_FilterMode); |
130 | 130 |
131 return GrBitmapTextGeoProc::Create(textures[texIdx], params, random->nextBoo
l()); | 131 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, |
| 132 random->nextBool()); |
132 } | 133 } |
OLD | NEW |