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