| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 107 |
| 110 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); | 108 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); |
| 111 | 109 |
| 112 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, | 110 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, |
| 113 GrContext*, | 111 GrContext*, |
| 114 const GrCaps&, | 112 const GrCaps&, |
| 115 GrTexture*[]) { | 113 GrTexture*[]) { |
| 116 return GrDisableColorXPFactory::Create(); | 114 return GrDisableColorXPFactory::Create(); |
| 117 } | 115 } |
| 118 | 116 |
| OLD | NEW |