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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 /////////////////////////////////////////////////////////////////////////////// | 99 /////////////////////////////////////////////////////////////////////////////// |
100 | 100 |
101 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, | 101 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, |
102 const GrTextureParams& params, bool use
ColorAttrib, | 102 const GrTextureParams& params, bool use
ColorAttrib, |
103 bool opaqueVertexColors, const SkMatrix
& localMatrix) | 103 bool opaqueVertexColors, const SkMatrix
& localMatrix) |
104 : INHERITED(color, SkMatrix::I(), localMatrix, opaqueVertexColors) | 104 : INHERITED(color, SkMatrix::I(), localMatrix, opaqueVertexColors) |
105 , fTextureAccess(texture, params) | 105 , fTextureAccess(texture, params) |
106 , fInColor(NULL) { | 106 , fInColor(NULL) { |
107 this->initClassID<GrBitmapTextGeoProc>(); | 107 this->initClassID<GrBitmapTextGeoProc>(); |
108 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 108 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
109 if (useColorAttrib) { | 109 if (useColorAttrib) { |
110 fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVerte
xAttribType)); | 110 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); |
111 this->setHasVertexColor(); | 111 this->setHasVertexColor(); |
112 } | 112 } |
113 fInTextureCoords = &this->addVertexAttrib(GrAttribute("inTextureCoords", | 113 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", |
114 kVec2f_GrVertexAttribT
ype)); | 114 kVec2f_GrVertexAttribT
ype)); |
115 this->addTextureAccess(&fTextureAccess); | 115 this->addTextureAccess(&fTextureAccess); |
116 } | 116 } |
117 | 117 |
118 bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const { | 118 bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const { |
119 const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>(); | 119 const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>(); |
120 return SkToBool(this->inColor()) == SkToBool(gp.inColor()); | 120 return SkToBool(this->inColor()) == SkToBool(gp.inColor()); |
121 } | 121 } |
122 | 122 |
123 void GrBitmapTextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* ou
t) const { | 123 void GrBitmapTextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* ou
t) const { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 181 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
182 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 182 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
183 }; | 183 }; |
184 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 184 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
185 GrTextureParams::kNon
e_FilterMode); | 185 GrTextureParams::kNon
e_FilterMode); |
186 | 186 |
187 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, | 187 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, |
188 random->nextBool(), random->nextBool(), | 188 random->nextBool(), random->nextBool(), |
189 GrProcessorUnitTest::TestMatrix(random)); | 189 GrProcessorUnitTest::TestMatrix(random)); |
190 } | 190 } |
OLD | NEW |