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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // emit transforms | 56 // emit transforms |
57 this->emitTransforms(vertBuilder, | 57 this->emitTransforms(vertBuilder, |
58 varyingHandler, | 58 varyingHandler, |
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.fFPCoordTransformHandler); | 63 args.fFPCoordTransformHandler); |
64 | 64 |
65 if (cte.maskFormat() == kARGB_GrMaskFormat) { | 65 if (cte.maskFormat() == kARGB_GrMaskFormat) { |
66 fragBuilder->codeAppendf("%s = ", args.fOutputColor); | 66 if (!cte.colorIgnored()) { |
67 fragBuilder->appendTextureLookupAndModulate(args.fOutputColor, | 67 fragBuilder->codeAppendf("%s = ", args.fOutputColor); |
68 args.fTexSamplers[0], | 68 fragBuilder->appendTextureLookupAndModulate(args.fOutputColor, |
69 v.fsIn(), | 69 args.fTexSamplers[0]
, |
70 kVec2f_GrSLType); | 70 v.fsIn(), |
71 fragBuilder->codeAppend(";"); | 71 kVec2f_GrSLType); |
72 fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage); | 72 fragBuilder->codeAppend(";"); |
| 73 fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage); |
| 74 } |
73 } else { | 75 } else { |
74 fragBuilder->codeAppendf("%s = ", args.fOutputCoverage); | 76 fragBuilder->codeAppendf("%s = ", args.fOutputCoverage); |
75 fragBuilder->appendTextureLookup(args.fTexSamplers[0], v.fsIn(), kVe
c2f_GrSLType); | 77 fragBuilder->appendTextureLookup(args.fTexSamplers[0], v.fsIn(), kVe
c2f_GrSLType); |
76 fragBuilder->codeAppend(";"); | 78 fragBuilder->codeAppend(";"); |
77 if (cte.maskFormat() == kA565_GrMaskFormat) { | 79 if (cte.maskFormat() == kA565_GrMaskFormat) { |
78 // set alpha to be max of rgb coverage | 80 // set alpha to be max of rgb coverage |
79 fragBuilder->codeAppendf("%s.a = max(max(%s.r, %s.g), %s.b);", | 81 fragBuilder->codeAppendf("%s.a = max(max(%s.r, %s.g), %s.b);", |
80 args.fOutputCoverage, args.fOutputCover
age, | 82 args.fOutputCoverage, args.fOutputCover
age, |
81 args.fOutputCoverage, args.fOutputCover
age); | 83 args.fOutputCoverage, args.fOutputCover
age); |
82 } | 84 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 break; | 184 break; |
183 case 2: | 185 case 2: |
184 format = kARGB_GrMaskFormat; | 186 format = kARGB_GrMaskFormat; |
185 break; | 187 break; |
186 } | 188 } |
187 | 189 |
188 return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), d->fTextures[tex
Idx], params, | 190 return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), d->fTextures[tex
Idx], params, |
189 format, GrTest::TestMatrix(d->fRandom), | 191 format, GrTest::TestMatrix(d->fRandom), |
190 d->fRandom->nextBool()); | 192 d->fRandom->nextBool()); |
191 } | 193 } |
OLD | NEW |