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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 uniformHandler, | 59 uniformHandler, |
60 gpArgs->fPositionVar, | 60 gpArgs->fPositionVar, |
61 cte.inPosition()->fName, | 61 cte.inPosition()->fName, |
62 cte.localMatrix(), | 62 cte.localMatrix(), |
63 args.fTransformsIn, | 63 args.fTransformsIn, |
64 args.fTransformsOut); | 64 args.fTransformsOut); |
65 | 65 |
66 if (cte.maskFormat() == kARGB_GrMaskFormat) { | 66 if (cte.maskFormat() == kARGB_GrMaskFormat) { |
67 fragBuilder->codeAppendf("%s = ", args.fOutputColor); | 67 fragBuilder->codeAppendf("%s = ", args.fOutputColor); |
68 fragBuilder->appendTextureLookupAndModulate(args.fOutputColor, | 68 fragBuilder->appendTextureLookupAndModulate(args.fOutputColor, |
69 args.fSamplers[0], | 69 args.fTexSamplers[0], |
70 v.fsIn(), | 70 v.fsIn(), |
71 kVec2f_GrSLType); | 71 kVec2f_GrSLType); |
72 fragBuilder->codeAppend(";"); | 72 fragBuilder->codeAppend(";"); |
73 fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage); | 73 fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage); |
74 } else { | 74 } else { |
75 fragBuilder->codeAppendf("%s = ", args.fOutputCoverage); | 75 fragBuilder->codeAppendf("%s = ", args.fOutputCoverage); |
76 fragBuilder->appendTextureLookup(args.fSamplers[0], v.fsIn(), kVec2f
_GrSLType); | 76 fragBuilder->appendTextureLookup(args.fTexSamplers[0], v.fsIn(), kVe
c2f_GrSLType); |
77 fragBuilder->codeAppend(";"); | 77 fragBuilder->codeAppend(";"); |
78 if (cte.maskFormat() == kA565_GrMaskFormat) { | 78 if (cte.maskFormat() == kA565_GrMaskFormat) { |
79 // set alpha to be max of rgb coverage | 79 // set alpha to be max of rgb coverage |
80 fragBuilder->codeAppendf("%s.a = max(max(%s.r, %s.g), %s.b);", | 80 fragBuilder->codeAppendf("%s.a = max(max(%s.r, %s.g), %s.b);", |
81 args.fOutputCoverage, args.fOutputCover
age, | 81 args.fOutputCoverage, args.fOutputCover
age, |
82 args.fOutputCoverage, args.fOutputCover
age); | 82 args.fOutputCoverage, args.fOutputCover
age); |
83 } | 83 } |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 break; | 189 break; |
190 case 2: | 190 case 2: |
191 format = kARGB_GrMaskFormat; | 191 format = kARGB_GrMaskFormat; |
192 break; | 192 break; |
193 } | 193 } |
194 | 194 |
195 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t
exIdx], params, | 195 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t
exIdx], params, |
196 format, GrTest::TestMatrix(d->fRandom), | 196 format, GrTest::TestMatrix(d->fRandom), |
197 d->fRandom->nextBool()); | 197 d->fRandom->nextBool()); |
198 } | 198 } |
OLD | NEW |