| 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 25 matching lines...) Expand all Loading... |
| 36 SkScalar recipWidth = 1.0f / atlas->width(); | 36 SkScalar recipWidth = 1.0f / atlas->width(); |
| 37 SkScalar recipHeight = 1.0f / atlas->height(); | 37 SkScalar recipHeight = 1.0f / atlas->height(); |
| 38 | 38 |
| 39 GrGLSLVertToFrag v(kVec2f_GrSLType); | 39 GrGLSLVertToFrag v(kVec2f_GrSLType); |
| 40 varyingHandler->addVarying("TextureCoords", &v); | 40 varyingHandler->addVarying("TextureCoords", &v); |
| 41 vertBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", v.vsOut(), | 41 vertBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", v.vsOut(), |
| 42 GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipWidth, | 42 GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipWidth, |
| 43 GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipHeight, | 43 GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipHeight, |
| 44 cte.inTextureCoords()->fName); | 44 cte.inTextureCoords()->fName); |
| 45 | 45 |
| 46 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 46 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 47 // Setup pass through color | 47 // Setup pass through color |
| 48 if (!cte.colorIgnored()) { | 48 if (!cte.colorIgnored()) { |
| 49 if (cte.hasVertexColor()) { | 49 if (cte.hasVertexColor()) { |
| 50 varyingHandler->addPassThroughAttribute(cte.inColor(), args.fOut
putColor); | 50 varyingHandler->addPassThroughAttribute(cte.inColor(), args.fOut
putColor); |
| 51 } else { | 51 } else { |
| 52 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutpu
tColor, | 52 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutpu
tColor, |
| 53 &fColorUniform); | 53 &fColorUniform); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 break; | 192 break; |
| 193 case 2: | 193 case 2: |
| 194 format = kARGB_GrMaskFormat; | 194 format = kARGB_GrMaskFormat; |
| 195 break; | 195 break; |
| 196 } | 196 } |
| 197 | 197 |
| 198 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t
exIdx], params, | 198 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t
exIdx], params, |
| 199 format, GrTest::TestMatrix(d->fRandom), | 199 format, GrTest::TestMatrix(d->fRandom), |
| 200 d->fRandom->nextBool()); | 200 d->fRandom->nextBool()); |
| 201 } | 201 } |
| OLD | NEW |