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

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

Issue 1125283005: Only discard for XP dstCopies if we have a coverage value. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 5 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/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 "GrColor.h" 10 #include "GrColor.h"
(...skipping 11 matching lines...) Expand all
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 hasSecondaryOutput() const override { return false; } 30 bool hasSecondaryOutput() const override { return false; }
31 31
32 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
33 const GrProcOptInfo& coveragePOI,
34 bool doesStencilWrite,
35 GrColor* color,
36 const GrDrawTargetCaps& caps) ove rride;
37
38 bool invertCoverage() const { return fInvertCoverage; } 32 bool invertCoverage() const { return fInvertCoverage; }
39 33
40 private: 34 private:
41 CoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage); 35 CoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage);
42 36
37 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
38 const GrProcOptInfo& coveragePO I,
39 bool doesStencilWrite,
40 GrColor* color,
41 const GrDrawTargetCaps& caps) o verride;
42
43 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 43 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override;
44 44
45 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; 45 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override;
46 46
47 bool onIsEqual(const GrXferProcessor& xpBase) const override { 47 bool onIsEqual(const GrXferProcessor& xpBase) const override {
48 const CoverageSetOpXP& xp = xpBase.cast<CoverageSetOpXP>(); 48 const CoverageSetOpXP& xp = xpBase.cast<CoverageSetOpXP>();
49 return (fRegionOp == xp.fRegionOp && 49 return (fRegionOp == xp.fRegionOp &&
50 fInvertCoverage == xp.fInvertCoverage); 50 fInvertCoverage == xp.fInvertCoverage);
51 } 51 }
52 52
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 void CoverageSetOpXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey Builder* b) const { 102 void CoverageSetOpXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey Builder* b) const {
103 GLCoverageSetOpXP::GenKey(*this, caps, b); 103 GLCoverageSetOpXP::GenKey(*this, caps, b);
104 } 104 }
105 105
106 GrGLXferProcessor* CoverageSetOpXP::createGLInstance() const { 106 GrGLXferProcessor* CoverageSetOpXP::createGLInstance() const {
107 return SkNEW_ARGS(GLCoverageSetOpXP, (*this)); 107 return SkNEW_ARGS(GLCoverageSetOpXP, (*this));
108 } 108 }
109 109
110 GrXferProcessor::OptFlags 110 GrXferProcessor::OptFlags
111 CoverageSetOpXP::getOptimizations(const GrProcOptInfo& colorPOI, 111 CoverageSetOpXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
112 const GrProcOptInfo& coveragePOI, 112 const GrProcOptInfo& coveragePOI,
113 bool doesStencilWrite, 113 bool doesStencilWrite,
114 GrColor* color, 114 GrColor* color,
115 const GrDrawTargetCaps& caps) { 115 const GrDrawTargetCaps& caps) {
116 // We never look at the color input 116 // We never look at the color input
117 return GrXferProcessor::kIgnoreColor_OptFlag; 117 return GrXferProcessor::kIgnoreColor_OptFlag;
118 } 118 }
119 119
120 void CoverageSetOpXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) cons t { 120 void CoverageSetOpXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) cons t {
121 switch (fRegionOp) { 121 switch (fRegionOp) {
122 case SkRegion::kReplace_Op: 122 case SkRegion::kReplace_Op:
123 blendInfo->fSrcBlend = kOne_GrBlendCoeff; 123 blendInfo->fSrcBlend = kOne_GrBlendCoeff;
124 blendInfo->fDstBlend = kZero_GrBlendCoeff; 124 blendInfo->fDstBlend = kZero_GrBlendCoeff;
125 break; 125 break;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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