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