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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, | 132 GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, |
133 const GrTextureParams& params, GrMaskFo
rmat format, | 133 const GrTextureParams& params, GrMaskFo
rmat format, |
134 const SkMatrix& localMatrix, bool usesL
ocalCoords) | 134 const SkMatrix& localMatrix, bool usesL
ocalCoords) |
135 : fColor(color) | 135 : fColor(color) |
136 , fLocalMatrix(localMatrix) | 136 , fLocalMatrix(localMatrix) |
137 , fUsesLocalCoords(usesLocalCoords) | 137 , fUsesLocalCoords(usesLocalCoords) |
138 , fTextureAccess(texture, params) | 138 , fTextureAccess(texture, params) |
139 , fInColor(nullptr) | 139 , fInColor(nullptr) |
140 , fMaskFormat(format) { | 140 , fMaskFormat(format) { |
141 this->initClassID<GrBitmapTextGeoProc>(); | 141 this->initClassID<GrBitmapTextGeoProc>(); |
142 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 142 fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType
); |
143 | 143 |
144 bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat || | 144 bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat || |
145 kA565_GrMaskFormat == fMaskFormat; | 145 kA565_GrMaskFormat == fMaskFormat; |
146 if (hasVertexColor) { | 146 if (hasVertexColor) { |
147 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); | 147 fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType)
; |
148 } | 148 } |
149 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", | 149 fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVert
exAttribType, |
150 kVec2us_GrVertexAttribTy
pe, | 150 kHigh_GrSLPrecision); |
151 kHigh_GrSLPrecision)); | |
152 this->addTextureAccess(&fTextureAccess); | 151 this->addTextureAccess(&fTextureAccess); |
153 } | 152 } |
154 | 153 |
155 void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, | 154 void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, |
156 GrProcessorKeyBuilder* b) const { | 155 GrProcessorKeyBuilder* b) const { |
157 GrGLBitmapTextGeoProc::GenKey(*this, caps, b); | 156 GrGLBitmapTextGeoProc::GenKey(*this, caps, b); |
158 } | 157 } |
159 | 158 |
160 GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrGLSLCa
ps& caps) const { | 159 GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrGLSLCa
ps& caps) const { |
161 return new GrGLBitmapTextGeoProc(); | 160 return new GrGLBitmapTextGeoProc(); |
(...skipping 28 matching lines...) Expand all Loading... |
190 break; | 189 break; |
191 case 2: | 190 case 2: |
192 format = kARGB_GrMaskFormat; | 191 format = kARGB_GrMaskFormat; |
193 break; | 192 break; |
194 } | 193 } |
195 | 194 |
196 return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), d->fTextures[tex
Idx], params, | 195 return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), d->fTextures[tex
Idx], params, |
197 format, GrTest::TestMatrix(d->fRandom), | 196 format, GrTest::TestMatrix(d->fRandom), |
198 d->fRandom->nextBool()); | 197 d->fRandom->nextBool()); |
199 } | 198 } |
OLD | NEW |