| 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 "GrFontAtlasSizes.h" | 9 #include "GrFontAtlasSizes.h" |
| 10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 GrGLGPBuilder* pb = args.fPB; | 33 GrGLGPBuilder* pb = args.fPB; |
| 34 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); | 34 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); |
| 35 | 35 |
| 36 // emit attributes | 36 // emit attributes |
| 37 vsBuilder->emitAttributes(cte); | 37 vsBuilder->emitAttributes(cte); |
| 38 | 38 |
| 39 GrGLVertToFrag v(kVec2f_GrSLType); | 39 GrGLVertToFrag v(kVec2f_GrSLType); |
| 40 pb->addVarying("TextureCoords", &v); | 40 pb->addVarying("TextureCoords", &v); |
| 41 // this is only used with text, so our texture bounds always match the g
lyph atlas | 41 // this is only used with text, so our texture bounds always match the g
lyph atlas |
| 42 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_RECIP_WIDTH ", " | 42 if (cte.maskFormat() == kA8_GrMaskFormat) { |
| 43 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut(), | 43 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ",
" |
| 44 cte.inTextureCoords()->fName); | 44 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut()
, |
| 45 cte.inTextureCoords()->fName); |
| 46 } else { |
| 47 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_RECIP_WIDTH ", " |
| 48 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut()
, |
| 49 cte.inTextureCoords()->fName); |
| 50 } |
| 45 | 51 |
| 46 // Setup pass through color | 52 // Setup pass through color |
| 47 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
, cte.inColor(), | 53 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
, cte.inColor(), |
| 48 &fColorUniform); | 54 &fColorUniform); |
| 49 | 55 |
| 50 // Setup position | 56 // Setup position |
| 51 this->setupPosition(pb, gpArgs, cte.inPosition()->fName, cte.viewMatrix(
)); | 57 this->setupPosition(pb, gpArgs, cte.inPosition()->fName, cte.viewMatrix(
)); |
| 52 | 58 |
| 53 // emit transforms | 59 // emit transforms |
| 54 this->emitTransforms(args.fPB, gpArgs->fPositionVar, cte.inPosition()->f
Name, | 60 this->emitTransforms(args.fPB, gpArgs->fPositionVar, cte.inPosition()->f
Name, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 break; | 227 break; |
| 222 case 2: | 228 case 2: |
| 223 format = kARGB_GrMaskFormat; | 229 format = kARGB_GrMaskFormat; |
| 224 break; | 230 break; |
| 225 } | 231 } |
| 226 | 232 |
| 227 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, | 233 return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx],
params, |
| 228 format, random->nextBool(), | 234 format, random->nextBool(), |
| 229 GrProcessorUnitTest::TestMatrix(random)); | 235 GrProcessorUnitTest::TestMatrix(random)); |
| 230 } | 236 } |
| OLD | NEW |