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 "GrDistanceFieldTextureEffect.h" | 8 #include "GrDistanceFieldTextureEffect.h" |
9 #include "GrFontAtlasSizes.h" | 9 #include "GrFontAtlasSizes.h" |
10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // emit attributes | 49 // emit attributes |
50 vsBuilder->emitAttributes(dfTexEffect); | 50 vsBuilder->emitAttributes(dfTexEffect); |
51 | 51 |
52 GrGLVertToFrag st(kVec2f_GrSLType); | 52 GrGLVertToFrag st(kVec2f_GrSLType); |
53 args.fPB->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision); | 53 args.fPB->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision); |
54 vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoor
ds()->fName); | 54 vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoor
ds()->fName); |
55 | 55 |
56 GrGLVertToFrag uv(kVec2f_GrSLType); | 56 GrGLVertToFrag uv(kVec2f_GrSLType); |
57 args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); | 57 args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); |
58 // this is only used with text, so our texture bounds always match the g
lyph atlas | 58 // this is only used with text, so our texture bounds always match the g
lyph atlas |
59 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_RECIP_WIDTH ", " | 59 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", " |
60 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(), | 60 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(), |
61 dfTexEffect.inTextureCoords()->fName); | 61 dfTexEffect.inTextureCoords()->fName); |
62 | 62 |
63 // Setup pass through color | 63 // Setup pass through color |
64 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
, | 64 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
, |
65 dfTexEffect.inColor(), &fColorUniform); | 65 dfTexEffect.inColor(), &fColorUniform); |
66 | 66 |
67 // Setup position | 67 // Setup position |
68 this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEf
fect.viewMatrix()); | 68 this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEf
fect.viewMatrix()); |
69 | 69 |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // emit attributes | 575 // emit attributes |
576 vsBuilder->emitAttributes(dfTexEffect); | 576 vsBuilder->emitAttributes(dfTexEffect); |
577 | 577 |
578 GrGLVertToFrag st(kVec2f_GrSLType); | 578 GrGLVertToFrag st(kVec2f_GrSLType); |
579 args.fPB->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision); | 579 args.fPB->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision); |
580 vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoor
ds()->fName); | 580 vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoor
ds()->fName); |
581 | 581 |
582 GrGLVertToFrag uv(kVec2f_GrSLType); | 582 GrGLVertToFrag uv(kVec2f_GrSLType); |
583 args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); | 583 args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); |
584 // this is only used with text, so our texture bounds always match the g
lyph atlas | 584 // this is only used with text, so our texture bounds always match the g
lyph atlas |
585 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_RECIP_WIDTH ", " | 585 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", " |
586 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(), | 586 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(), |
587 dfTexEffect.inTextureCoords()->fName); | 587 dfTexEffect.inTextureCoords()->fName); |
588 | 588 |
589 // setup pass through color | 589 // setup pass through color |
590 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
, NULL, | 590 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor
, NULL, |
591 &fColorUniform); | 591 &fColorUniform); |
592 | 592 |
593 // Setup position | 593 // Setup position |
594 this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEf
fect.viewMatrix()); | 594 this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEf
fect.viewMatrix()); |
595 | 595 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 856 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
857 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 857 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
858 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 858 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
859 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), | 859 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), |
860 GrProcessorUnitTest::TestMatr
ix(random), | 860 GrProcessorUnitTest::TestMatr
ix(random), |
861 textures[texIdx], params, | 861 textures[texIdx], params, |
862 textures[texIdx2], params2, | 862 textures[texIdx2], params2, |
863 textColor, | 863 textColor, |
864 flags); | 864 flags); |
865 } | 865 } |
OLD | NEW |