| 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() { return new DisableColorXP; } |
| 21 return SkNEW(DisableColorXP); | |
| 22 } | |
| 23 | 21 |
| 24 ~DisableColorXP() override {}; | 22 ~DisableColorXP() override {}; |
| 25 | 23 |
| 26 const char* name() const override { return "Disable Color"; } | 24 const char* name() const override { return "Disable Color"; } |
| 27 | 25 |
| 28 GrGLXferProcessor* createGLInstance() const override; | 26 GrGLXferProcessor* createGLInstance() const override; |
| 29 | 27 |
| 30 private: | 28 private: |
| 31 DisableColorXP(); | 29 DisableColorXP(); |
| 32 | 30 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 /////////////////////////////////////////////////////////////////////////////// | 74 /////////////////////////////////////////////////////////////////////////////// |
| 77 | 75 |
| 78 DisableColorXP::DisableColorXP() { | 76 DisableColorXP::DisableColorXP() { |
| 79 this->initClassID<DisableColorXP>(); | 77 this->initClassID<DisableColorXP>(); |
| 80 } | 78 } |
| 81 | 79 |
| 82 void DisableColorXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB
uilder* b) const { | 80 void DisableColorXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB
uilder* b) const { |
| 83 GLDisableColorXP::GenKey(*this, caps, b); | 81 GLDisableColorXP::GenKey(*this, caps, b); |
| 84 } | 82 } |
| 85 | 83 |
| 86 GrGLXferProcessor* DisableColorXP::createGLInstance() const { | 84 GrGLXferProcessor* DisableColorXP::createGLInstance() const { return new GLDisab
leColorXP(*this); } |
| 87 return SkNEW_ARGS(GLDisableColorXP, (*this)); | |
| 88 } | |
| 89 | 85 |
| 90 void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const
{ | 86 void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const
{ |
| 91 blendInfo->fWriteColor = false; | 87 blendInfo->fWriteColor = false; |
| 92 } | 88 } |
| 93 | 89 |
| 94 /////////////////////////////////////////////////////////////////////////////// | 90 /////////////////////////////////////////////////////////////////////////////// |
| 95 | 91 |
| 96 GrDisableColorXPFactory::GrDisableColorXPFactory() { | 92 GrDisableColorXPFactory::GrDisableColorXPFactory() { |
| 97 this->initClassID<GrDisableColorXPFactory>(); | 93 this->initClassID<GrDisableColorXPFactory>(); |
| 98 } | 94 } |
| 99 | 95 |
| 100 GrXferProcessor* | 96 GrXferProcessor* |
| 101 GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps, | 97 GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps, |
| 102 const GrProcOptInfo& colorPOI, | 98 const GrProcOptInfo& colorPOI, |
| 103 const GrProcOptInfo& covPOI, | 99 const GrProcOptInfo& covPOI, |
| 104 bool hasMixedSamples, | 100 bool hasMixedSamples, |
| 105 const DstTexture* dst) const { | 101 const DstTexture* dst) const { |
| 106 return DisableColorXP::Create(); | 102 return DisableColorXP::Create(); |
| 107 } | 103 } |
| 108 | 104 |
| 109 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); | 105 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); |
| 110 | 106 |
| 111 GrXPFactory* GrDisableColorXPFactory::TestCreate(GrProcessorTestData*) { | 107 GrXPFactory* GrDisableColorXPFactory::TestCreate(GrProcessorTestData*) { |
| 112 return GrDisableColorXPFactory::Create(); | 108 return GrDisableColorXPFactory::Create(); |
| 113 } | 109 } |
| 114 | 110 |
| OLD | NEW |