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 17 matching lines...) Expand all Loading... |
28 GrGLSLXferProcessor* createGLSLInstance() const override; | 28 GrGLSLXferProcessor* createGLSLInstance() const override; |
29 | 29 |
30 bool invertCoverage() const { return fInvertCoverage; } | 30 bool invertCoverage() const { return fInvertCoverage; } |
31 | 31 |
32 private: | 32 private: |
33 CoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage); | 33 CoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage); |
34 | 34 |
35 GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations&
optimizations, | 35 GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations&
optimizations, |
36 bool doesStencilWrite, | 36 bool doesStencilWrite, |
37 GrColor* color, | 37 GrColor* color, |
38 const GrCaps& caps) override; | 38 const GrCaps& caps) const overr
ide; |
39 | 39 |
40 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b)
const override; | 40 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b)
const override; |
41 | 41 |
42 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; | 42 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; |
43 | 43 |
44 bool onIsEqual(const GrXferProcessor& xpBase) const override { | 44 bool onIsEqual(const GrXferProcessor& xpBase) const override { |
45 const CoverageSetOpXP& xp = xpBase.cast<CoverageSetOpXP>(); | 45 const CoverageSetOpXP& xp = xpBase.cast<CoverageSetOpXP>(); |
46 return (fRegionOp == xp.fRegionOp && | 46 return (fRegionOp == xp.fRegionOp && |
47 fInvertCoverage == xp.fInvertCoverage); | 47 fInvertCoverage == xp.fInvertCoverage); |
48 } | 48 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 GrGLSLXferProcessor* CoverageSetOpXP::createGLSLInstance() const { | 104 GrGLSLXferProcessor* CoverageSetOpXP::createGLSLInstance() const { |
105 return new GLCoverageSetOpXP(*this); | 105 return new GLCoverageSetOpXP(*this); |
106 } | 106 } |
107 | 107 |
108 GrXferProcessor::OptFlags | 108 GrXferProcessor::OptFlags |
109 CoverageSetOpXP::onGetOptimizations(const GrPipelineOptimizations& optimizations
, | 109 CoverageSetOpXP::onGetOptimizations(const GrPipelineOptimizations& optimizations
, |
110 bool doesStencilWrite, | 110 bool doesStencilWrite, |
111 GrColor* color, | 111 GrColor* color, |
112 const GrCaps& caps) { | 112 const GrCaps& caps) const { |
113 // We never look at the color input | 113 // We never look at the color input |
114 return GrXferProcessor::kIgnoreColor_OptFlag; | 114 return GrXferProcessor::kIgnoreColor_OptFlag; |
115 } | 115 } |
116 | 116 |
117 void CoverageSetOpXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) cons
t { | 117 void CoverageSetOpXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) cons
t { |
118 switch (fRegionOp) { | 118 switch (fRegionOp) { |
119 case SkRegion::kReplace_Op: | 119 case SkRegion::kReplace_Op: |
120 blendInfo->fSrcBlend = kOne_GrBlendCoeff; | 120 blendInfo->fSrcBlend = kOne_GrBlendCoeff; |
121 blendInfo->fDstBlend = kZero_GrBlendCoeff; | 121 blendInfo->fDstBlend = kZero_GrBlendCoeff; |
122 break; | 122 break; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); | 244 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); |
245 | 245 |
246 const GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d)
{ | 246 const GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d)
{ |
247 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa
stOp + 1)); | 247 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa
stOp + 1)); |
248 bool invertCoverage = !d->fRenderTarget->hasMixedSamples() && d->fRandom->ne
xtBool(); | 248 bool invertCoverage = !d->fRenderTarget->hasMixedSamples() && d->fRandom->ne
xtBool(); |
249 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); | 249 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); |
250 } | 250 } |
251 | 251 |
OLD | NEW |