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

Side by Side Diff: src/gpu/effects/GrDisableColorXP.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/GrDisableColorXP.h ('k') | src/gpu/effects/GrDistanceFieldGeoProc.h » ('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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "effects/GrDisableColorXP.h" 8 #include "effects/GrDisableColorXP.h"
9 #include "GrProcessor.h" 9 #include "GrProcessor.h"
10 #include "gl/GrGLXferProcessor.h" 10 #include "gl/GrGLXferProcessor.h"
11 #include "glsl/GrGLSLFragmentShaderBuilder.h" 11 #include "glsl/GrGLSLFragmentShaderBuilder.h"
12 #include "glsl/GrGLSLProgramBuilder.h" 12 #include "glsl/GrGLSLProgramBuilder.h"
13 #include "glsl/GrGLSLProgramDataManager.h" 13 #include "glsl/GrGLSLProgramDataManager.h"
14 14
15 /** 15 /**
16 * This xfer processor disables color writing. Thus color and coverage and ignor ed and no blending 16 * This xfer processor disables color writing. Thus color and coverage and ignor ed and no blending
17 * occurs. This XP is usful for things like stenciling. 17 * occurs. This XP is usful for things like stenciling.
18 */ 18 */
19 class DisableColorXP : public GrXferProcessor { 19 class DisableColorXP : public GrXferProcessor {
20 public: 20 public:
21 static GrXferProcessor* Create() { return new DisableColorXP; } 21 static GrXferProcessor* Create(GrRenderTarget* dst) {
22 return new DisableColorXP(dst);
23 }
22 24
23 ~DisableColorXP() override {}; 25 ~DisableColorXP() override {};
24 26
25 const char* name() const override { return "Disable Color"; } 27 const char* name() const override { return "Disable Color"; }
26 28
27 GrGLXferProcessor* createGLInstance() const override; 29 GrGLXferProcessor* createGLInstance() const override;
28 30
29 private: 31 private:
30 DisableColorXP(); 32 DisableColorXP(GrRenderTarget* dst);
31 33
32 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 34 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
33 const GrProcOptInfo& coveragePO I, 35 const GrProcOptInfo& coveragePO I,
34 bool doesStencilWrite, 36 bool doesStencilWrite,
35 GrColor* color, 37 GrColor* color,
36 const GrCaps& caps) override { 38 const GrCaps& caps) override {
37 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC overage_OptFlag; 39 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC overage_OptFlag;
38 } 40 }
39 41
40 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 42 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override;
(...skipping 26 matching lines...) Expand all
67 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary); 69 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary);
68 } 70 }
69 71
70 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {} 72 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {}
71 73
72 typedef GrGLXferProcessor INHERITED; 74 typedef GrGLXferProcessor INHERITED;
73 }; 75 };
74 76
75 /////////////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////////////
76 78
77 DisableColorXP::DisableColorXP() { 79 DisableColorXP::DisableColorXP(GrRenderTarget* dst) : INHERITED(dst) {
78 this->initClassID<DisableColorXP>(); 80 this->initClassID<DisableColorXP>();
79 } 81 }
80 82
81 void DisableColorXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const { 83 void DisableColorXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const {
82 GLDisableColorXP::GenKey(*this, caps, b); 84 GLDisableColorXP::GenKey(*this, caps, b);
83 } 85 }
84 86
85 GrGLXferProcessor* DisableColorXP::createGLInstance() const { return new GLDisab leColorXP(*this); } 87 GrGLXferProcessor* DisableColorXP::createGLInstance() const { return new GLDisab leColorXP(*this); }
86 88
87 void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const { 89 void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
88 blendInfo->fWriteColor = false; 90 blendInfo->fWriteColor = false;
89 } 91 }
90 92
91 /////////////////////////////////////////////////////////////////////////////// 93 ///////////////////////////////////////////////////////////////////////////////
92 94
93 GrDisableColorXPFactory::GrDisableColorXPFactory() { 95 GrDisableColorXPFactory::GrDisableColorXPFactory() {
94 this->initClassID<GrDisableColorXPFactory>(); 96 this->initClassID<GrDisableColorXPFactory>();
95 } 97 }
96 98
97 GrXferProcessor* 99 GrXferProcessor*
98 GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps, 100 GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps,
99 const GrProcOptInfo& colorPOI, 101 const GrProcOptInfo& colorPOI,
100 const GrProcOptInfo& covPOI, 102 const GrProcOptInfo& covPOI,
101 bool hasMixedSamples, 103 bool hasMixedSamples,
102 const DstTexture* dst) const { 104 const DstTexture* dst, GrRenderTa rget* dstRT) const {
103 return DisableColorXP::Create(); 105 return DisableColorXP::Create(dstRT);
104 } 106 }
105 107
106 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); 108 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory);
107 109
108 const GrXPFactory* GrDisableColorXPFactory::TestCreate(GrProcessorTestData*) { 110 const GrXPFactory* GrDisableColorXPFactory::TestCreate(GrProcessorTestData*) {
109 return GrDisableColorXPFactory::Create(); 111 return GrDisableColorXPFactory::Create();
110 } 112 }
111 113
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.h ('k') | src/gpu/effects/GrDistanceFieldGeoProc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698