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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 const SkMatrix& localMatrix, bool usesL
ocalCoords) | 137 const SkMatrix& localMatrix, bool usesL
ocalCoords) |
138 : fColor(color) | 138 : fColor(color) |
139 , fLocalMatrix(localMatrix) | 139 , fLocalMatrix(localMatrix) |
140 , fUsesLocalCoords(usesLocalCoords) | 140 , fUsesLocalCoords(usesLocalCoords) |
141 , fTextureAccess(texture, params) | 141 , fTextureAccess(texture, params) |
142 , fInColor(nullptr) | 142 , fInColor(nullptr) |
143 , fMaskFormat(format) { | 143 , fMaskFormat(format) { |
144 this->initClassID<GrBitmapTextGeoProc>(); | 144 this->initClassID<GrBitmapTextGeoProc>(); |
145 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 145 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
146 | 146 |
147 // TODO we could think about removing this attribute if color is ignored, bu
t unfortunately | 147 bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat || |
148 // we don't do text positioning in batch, so we can't quite do that yet. | 148 kA565_GrMaskFormat == fMaskFormat; |
149 bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat; | |
150 if (hasVertexColor) { | 149 if (hasVertexColor) { |
151 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); | 150 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); |
152 } | 151 } |
153 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", | 152 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", |
154 kVec2s_GrVertexAttribTyp
e)); | 153 kVec2s_GrVertexAttribTyp
e)); |
155 this->addTextureAccess(&fTextureAccess); | 154 this->addTextureAccess(&fTextureAccess); |
156 } | 155 } |
157 | 156 |
158 void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, | 157 void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, |
159 GrProcessorKeyBuilder* b) const { | 158 GrProcessorKeyBuilder* b) const { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 break; | 192 break; |
194 case 2: | 193 case 2: |
195 format = kARGB_GrMaskFormat; | 194 format = kARGB_GrMaskFormat; |
196 break; | 195 break; |
197 } | 196 } |
198 | 197 |
199 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t
exIdx], params, | 198 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t
exIdx], params, |
200 format, GrTest::TestMatrix(d->fRandom), | 199 format, GrTest::TestMatrix(d->fRandom), |
201 d->fRandom->nextBool()); | 200 d->fRandom->nextBool()); |
202 } | 201 } |
OLD | NEW |