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 "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const CoverageSetOpXP& xp = args.fXP.cast<CoverageSetOpXP>(); | 74 const CoverageSetOpXP& xp = args.fXP.cast<CoverageSetOpXP>(); |
75 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); | 75 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); |
76 | 76 |
77 if (xp.invertCoverage()) { | 77 if (xp.invertCoverage()) { |
78 fsBuilder->codeAppendf("%s = 1.0 - %s;", args.fOutputPrimary, args.f
InputCoverage); | 78 fsBuilder->codeAppendf("%s = 1.0 - %s;", args.fOutputPrimary, args.f
InputCoverage); |
79 } else { | 79 } else { |
80 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputC
overage); | 80 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputC
overage); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri
de {}; | 84 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over
ride {}; |
85 | 85 |
86 typedef GrGLXferProcessor INHERITED; | 86 typedef GrGLXferProcessor INHERITED; |
87 }; | 87 }; |
88 | 88 |
89 /////////////////////////////////////////////////////////////////////////////// | 89 /////////////////////////////////////////////////////////////////////////////// |
90 | 90 |
91 CoverageSetOpXP::CoverageSetOpXP(SkRegion::Op regionOp, bool invertCoverage) | 91 CoverageSetOpXP::CoverageSetOpXP(SkRegion::Op regionOp, bool invertCoverage) |
92 : fRegionOp(regionOp) | 92 : fRegionOp(regionOp) |
93 , fInvertCoverage(invertCoverage) { | 93 , fInvertCoverage(invertCoverage) { |
94 this->initClassID<CoverageSetOpXP>(); | 94 this->initClassID<CoverageSetOpXP>(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); | 246 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); |
247 | 247 |
248 const GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d)
{ | 248 const GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d)
{ |
249 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa
stOp + 1)); | 249 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa
stOp + 1)); |
250 bool invertCoverage = d->fRandom->nextBool(); | 250 bool invertCoverage = d->fRandom->nextBool(); |
251 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); | 251 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); |
252 } | 252 } |
253 | 253 |
OLD | NEW |