OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "effects/GrCoverageSetOpXP.h" | 9 #include "effects/GrCoverageSetOpXP.h" |
10 #include "GrColor.h" | 10 #include "GrColor.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 static void GenKey(const GrProcessor& processor, const GrGLSLCaps& caps, | 67 static void GenKey(const GrProcessor& processor, const GrGLSLCaps& caps, |
68 GrProcessorKeyBuilder* b) { | 68 GrProcessorKeyBuilder* b) { |
69 const CoverageSetOpXP& xp = processor.cast<CoverageSetOpXP>(); | 69 const CoverageSetOpXP& xp = processor.cast<CoverageSetOpXP>(); |
70 uint32_t key = xp.invertCoverage() ? 0x0 : 0x1; | 70 uint32_t key = xp.invertCoverage() ? 0x0 : 0x1; |
71 b->add32(key); | 71 b->add32(key); |
72 }; | 72 }; |
73 | 73 |
74 private: | 74 private: |
75 void onEmitCode(const EmitArgs& args) override { | 75 void onEmitCode(const EmitArgs& args) override { |
76 const CoverageSetOpXP& xp = args.fXP.cast<CoverageSetOpXP>(); | 76 const CoverageSetOpXP& xp = args.fXP.cast<CoverageSetOpXP>(); |
77 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); | 77 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); |
78 | 78 |
79 if (xp.invertCoverage()) { | 79 if (xp.invertCoverage()) { |
80 fsBuilder->codeAppendf("%s = 1.0 - %s;", args.fOutputPrimary, args.f
InputCoverage); | 80 fsBuilder->codeAppendf("%s = 1.0 - %s;", args.fOutputPrimary, args.f
InputCoverage); |
81 } else { | 81 } else { |
82 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputC
overage); | 82 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputC
overage); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri
de {}; | 86 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri
de {}; |
87 | 87 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 252 |
253 GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(SkRandom* random, | 253 GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(SkRandom* random, |
254 GrContext*, | 254 GrContext*, |
255 const GrDrawTargetCaps&, | 255 const GrDrawTargetCaps&, |
256 GrTexture*[]) { | 256 GrTexture*[]) { |
257 SkRegion::Op regionOp = SkRegion::Op(random->nextULessThan(SkRegion::kLastOp
+ 1)); | 257 SkRegion::Op regionOp = SkRegion::Op(random->nextULessThan(SkRegion::kLastOp
+ 1)); |
258 bool invertCoverage = random->nextBool(); | 258 bool invertCoverage = random->nextBool(); |
259 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); | 259 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); |
260 } | 260 } |
261 | 261 |
OLD | NEW |