Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: src/gpu/effects/GrCoverageSetOpXP.cpp

Issue 1471293003: Create a static instances of SrcOver XferProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Build Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrXferProcessor.cpp ('k') | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « src/gpu/GrXferProcessor.cpp ('k') | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698