| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 bool hasSecondaryOutput() const override { return false; } | 30 bool hasSecondaryOutput() const override { return false; } |
| 31 | 31 |
| 32 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | 32 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, |
| 33 const GrProcOptInfo& coveragePOI, | 33 const GrProcOptInfo& coveragePOI, |
| 34 bool doesStencilWrite, | 34 bool doesStencilWrite, |
| 35 GrColor* color, | 35 GrColor* color, |
| 36 const GrDrawTargetCaps& caps) ove
rride { | 36 const GrDrawTargetCaps& caps) ove
rride { |
| 37 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC
overage_OptFlag; | 37 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC
overage_OptFlag; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; | |
| 41 | |
| 42 private: | 40 private: |
| 43 DisableColorXP(); | 41 DisableColorXP(); |
| 44 | 42 |
| 45 void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con
st override; | 43 void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con
st override; |
| 46 | 44 |
| 45 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; |
| 46 |
| 47 bool onIsEqual(const GrXferProcessor& xpBase) const override { | 47 bool onIsEqual(const GrXferProcessor& xpBase) const override { |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 | 50 |
| 51 typedef GrXferProcessor INHERITED; | 51 typedef GrXferProcessor INHERITED; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 /////////////////////////////////////////////////////////////////////////////// | 54 /////////////////////////////////////////////////////////////////////////////// |
| 55 | 55 |
| 56 class GLDisableColorXP : public GrGLXferProcessor { | 56 class GLDisableColorXP : public GrGLXferProcessor { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DisableColorXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBui
lder* b) const { | 84 void DisableColorXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBui
lder* b) const { |
| 85 GLDisableColorXP::GenKey(*this, caps, b); | 85 GLDisableColorXP::GenKey(*this, caps, b); |
| 86 } | 86 } |
| 87 | 87 |
| 88 GrGLXferProcessor* DisableColorXP::createGLInstance() const { | 88 GrGLXferProcessor* DisableColorXP::createGLInstance() const { |
| 89 return SkNEW_ARGS(GLDisableColorXP, (*this)); | 89 return SkNEW_ARGS(GLDisableColorXP, (*this)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void DisableColorXP::getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const { | 92 void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const
{ |
| 93 blendInfo->fWriteColor = false; | 93 blendInfo->fWriteColor = false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 /////////////////////////////////////////////////////////////////////////////// | 96 /////////////////////////////////////////////////////////////////////////////// |
| 97 | 97 |
| 98 GrDisableColorXPFactory::GrDisableColorXPFactory() { | 98 GrDisableColorXPFactory::GrDisableColorXPFactory() { |
| 99 this->initClassID<GrDisableColorXPFactory>(); | 99 this->initClassID<GrDisableColorXPFactory>(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 GrXferProcessor* | 102 GrXferProcessor* |
| 103 GrDisableColorXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps, | 103 GrDisableColorXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps, |
| 104 const GrProcOptInfo& colorPOI, | 104 const GrProcOptInfo& colorPOI, |
| 105 const GrProcOptInfo& covPOI, | 105 const GrProcOptInfo& covPOI, |
| 106 const GrDeviceCoordTexture* dstCo
py) const { | 106 const GrDeviceCoordTexture* dstCo
py) const { |
| 107 return DisableColorXP::Create(); | 107 return DisableColorXP::Create(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); | 110 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); |
| 111 | 111 |
| 112 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, | 112 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, |
| 113 GrContext*, | 113 GrContext*, |
| 114 const GrDrawTargetCaps&, | 114 const GrDrawTargetCaps&, |
| 115 GrTexture*[]) { | 115 GrTexture*[]) { |
| 116 return GrDisableColorXPFactory::Create(); | 116 return GrDisableColorXPFactory::Create(); |
| 117 } | 117 } |
| 118 | 118 |
| OLD | NEW |