OLD | NEW |
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 "gl/builders/GrGLFragmentShaderBuilder.h" | 11 #include "gl/builders/GrGLFragmentShaderBuilder.h" |
12 #include "gl/builders/GrGLProgramBuilder.h" | 12 #include "gl/builders/GrGLProgramBuilder.h" |
13 | 13 |
14 /** | 14 /** |
15 * This xfer processor disables color writing. Thus color and coverage and ignor
ed and no blending | 15 * This xfer processor disables color writing. Thus color and coverage and ignor
ed and no blending |
16 * occurs. This XP is usful for things like stenciling. | 16 * occurs. This XP is usful for things like stenciling. |
17 */ | 17 */ |
18 class DisableColorXP : public GrXferProcessor { | 18 class DisableColorXP : public GrXferProcessor { |
19 public: | 19 public: |
20 static GrXferProcessor* Create() { | 20 static GrXferProcessor* Create() { |
21 return SkNEW(DisableColorXP); | 21 return SkNEW(DisableColorXP); |
22 } | 22 } |
23 | 23 |
24 ~DisableColorXP() override {}; | 24 ~DisableColorXP() override {}; |
25 | 25 |
26 const char* name() const override { return "Disable Color"; } | 26 const char* name() const override { return "Disable Color"; } |
27 | 27 |
28 GrGLXferProcessor* createGLInstance() const override; | 28 GrGLXferProcessor* createGLInstance() const override; |
29 | 29 |
30 bool hasSecondaryOutput() const override { return false; } | |
31 | |
32 private: | 30 private: |
33 DisableColorXP(); | 31 DisableColorXP(); |
34 | 32 |
35 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, | 33 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, |
36 const GrProcOptInfo& coveragePO
I, | 34 const GrProcOptInfo& coveragePO
I, |
37 bool doesStencilWrite, | 35 bool doesStencilWrite, |
38 GrColor* color, | 36 GrColor* color, |
39 const GrCaps& caps) override { | 37 const GrCaps& caps) override { |
40 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC
overage_OptFlag; | 38 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC
overage_OptFlag; |
41 } | 39 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 92 } |
95 | 93 |
96 /////////////////////////////////////////////////////////////////////////////// | 94 /////////////////////////////////////////////////////////////////////////////// |
97 | 95 |
98 GrDisableColorXPFactory::GrDisableColorXPFactory() { | 96 GrDisableColorXPFactory::GrDisableColorXPFactory() { |
99 this->initClassID<GrDisableColorXPFactory>(); | 97 this->initClassID<GrDisableColorXPFactory>(); |
100 } | 98 } |
101 | 99 |
102 GrXferProcessor* | 100 GrXferProcessor* |
103 GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps, | 101 GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps, |
| 102 const GrPipelineBuilder&, |
104 const GrProcOptInfo& colorPOI, | 103 const GrProcOptInfo& colorPOI, |
105 const GrProcOptInfo& covPOI, | 104 const GrProcOptInfo& covPOI, |
106 const DstTexture* dst) const { | 105 const DstTexture* dst) const { |
107 return DisableColorXP::Create(); | 106 return DisableColorXP::Create(); |
108 } | 107 } |
109 | 108 |
110 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); | 109 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); |
111 | 110 |
112 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, | 111 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, |
113 GrContext*, | 112 GrContext*, |
114 const GrCaps&, | 113 const GrCaps&, |
115 GrTexture*[]) { | 114 GrTexture*[]) { |
116 return GrDisableColorXPFactory::Create(); | 115 return GrDisableColorXPFactory::Create(); |
117 } | 116 } |
118 | 117 |
OLD | NEW |