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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 months 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/effects/GrConvolutionEffect.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"
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "GrProcessor.h" 12 #include "GrProcessor.h"
13 #include "GrProcOptInfo.h" 13 #include "GrProcOptInfo.h"
14 #include "gl/GrGLXferProcessor.h" 14 #include "gl/GrGLXferProcessor.h"
15 #include "glsl/GrGLSLProgramBuilder.h" 15 #include "glsl/GrGLSLProgramBuilder.h"
16 #include "glsl/GrGLSLFragmentShaderBuilder.h" 16 #include "glsl/GrGLSLFragmentShaderBuilder.h"
17 17
18 class CoverageSetOpXP : public GrXferProcessor { 18 class CoverageSetOpXP : public GrXferProcessor {
19 public: 19 public:
20 static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) { 20 static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage, G rRenderTarget* dst) {
21 return new CoverageSetOpXP(regionOp, invertCoverage); 21 return new CoverageSetOpXP(regionOp, invertCoverage, dst);
22 } 22 }
23 23
24 ~CoverageSetOpXP() override; 24 ~CoverageSetOpXP() override;
25 25
26 const char* name() const override { return "Coverage Set Op"; } 26 const char* name() const override { return "Coverage Set Op"; }
27 27
28 GrGLXferProcessor* createGLInstance() const override; 28 GrGLXferProcessor* createGLInstance() 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, GrRenderTarget* dst);
34 34
35 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 35 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
36 const GrProcOptInfo& coveragePO I, 36 const GrProcOptInfo& coveragePO I,
37 bool doesStencilWrite, 37 bool doesStencilWrite,
38 GrColor* color, 38 GrColor* color,
39 const GrCaps& caps) override; 39 const GrCaps& caps) override;
40 40
41 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 41 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override;
42 42
43 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; 43 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 } 82 }
83 83
84 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {}; 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, GrR enderTarget* dst)
92 : fRegionOp(regionOp) 92 : INHERITED(dst), fRegionOp(regionOp)
93 , fInvertCoverage(invertCoverage) { 93 , fInvertCoverage(invertCoverage) {
94 this->initClassID<CoverageSetOpXP>(); 94 this->initClassID<CoverageSetOpXP>();
95 } 95 }
96 96
97 CoverageSetOpXP::~CoverageSetOpXP() { 97 CoverageSetOpXP::~CoverageSetOpXP() {
98 } 98 }
99 99
100 void CoverageSetOpXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey Builder* b) const { 100 void CoverageSetOpXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey Builder* b) const {
101 GLCoverageSetOpXP::GenKey(*this, caps, b); 101 GLCoverageSetOpXP::GenKey(*this, caps, b);
102 } 102 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 default: 218 default:
219 return nullptr; 219 return nullptr;
220 } 220 }
221 } 221 }
222 222
223 GrXferProcessor* 223 GrXferProcessor*
224 GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps, 224 GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps,
225 const GrProcOptInfo& colorPOI, 225 const GrProcOptInfo& colorPOI,
226 const GrProcOptInfo& covPOI, 226 const GrProcOptInfo& covPOI,
227 bool hasMixedSamples, 227 bool hasMixedSamples,
228 const DstTexture* dst) const { 228 const DstTexture* dst, GrRenderT arget* dstRT) const {
229 // We don't support inverting coverage with mixed samples. We don't expect t o ever want this in 229 // We don't support inverting coverage with mixed samples. We don't expect t o ever want this in
230 // the future, however we could at some point make this work using an invert ed coverage 230 // the future, however we could at some point make this work using an invert ed coverage
231 // modulation table. Note that an inverted table still won't work if there a re coverage procs. 231 // modulation table. Note that an inverted table still won't work if there a re coverage procs.
232 if (fInvertCoverage && hasMixedSamples) { 232 if (fInvertCoverage && hasMixedSamples) {
233 SkASSERT(false); 233 SkASSERT(false);
234 return nullptr; 234 return nullptr;
235 } 235 }
236 236
237 return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage); 237 return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage, dstRT);
238 } 238 }
239 239
240 void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col orPOI, 240 void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col orPOI,
241 InvariantBlendedColor* b lendedColor) const { 241 InvariantBlendedColor* b lendedColor) const {
242 blendedColor->fWillBlendWithDst = SkRegion::kReplace_Op != fRegionOp; 242 blendedColor->fWillBlendWithDst = SkRegion::kReplace_Op != fRegionOp;
243 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 243 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
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
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvolutionEffect.cpp ('k') | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698