egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrDisableColorXP_DEFINED |
| 9 | #define GrDisableColorXP_DEFINED |
| 10 | |
| 11 | #include "GrTypes.h" |
| 12 | #include "GrXferProcessor.h" |
| 13 | |
| 14 | class GrProcOptInfo; |
| 15 | |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 16 | class GrDisableColorXPFactory : public GrXPFactory { |
| 17 | public: |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 18 | static GrXPFactory* Create() { return new GrDisableColorXPFactory; } |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 19 | |
cdalton | 1fa4572 | 2015-06-02 10:43:39 -0700 | [diff] [blame] | 20 | void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, |
| 21 | GrXPFactory::InvariantBlendedColor* blendedColor) const override { |
| 22 | blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; |
| 23 | blendedColor->fWillBlendWithDst = false; |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 24 | } |
| 25 | |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 26 | private: |
| 27 | GrDisableColorXPFactory(); |
| 28 | |
bsalomon | 4b91f76 | 2015-05-19 09:29:46 -0700 | [diff] [blame] | 29 | GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, |
ethannicholas | de4166a | 2015-11-30 08:57:38 -0800 | [diff] [blame] | 30 | const GrPipelineOptimizations& optimizations, |
cdalton | 86ae0a9 | 2015-06-08 15:11:04 -0700 | [diff] [blame] | 31 | bool hasMixedSamples, |
bsalomon | 6a44c6a | 2015-05-26 09:49:05 -0700 | [diff] [blame] | 32 | const DstTexture* dstTexture) const override; |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 33 | |
ethannicholas | 2279325 | 2016-01-30 09:59:10 -0800 | [diff] [blame] | 34 | bool onWillReadDstColor(const GrCaps& caps, |
| 35 | const GrPipelineOptimizations& optimizations, |
| 36 | bool hasMixedSamples) const override { |
egdaniel | e36914c | 2015-02-13 09:00:33 -0800 | [diff] [blame] | 37 | return false; |
| 38 | } |
bsalomon | 50785a3 | 2015-02-06 07:02:37 -0800 | [diff] [blame] | 39 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 40 | bool onIsEqual(const GrXPFactory& xpfBase) const override { |
egdaniel | 080e673 | 2014-12-22 07:35:52 -0800 | [diff] [blame] | 41 | return true; |
| 42 | } |
| 43 | |
| 44 | GR_DECLARE_XP_FACTORY_TEST; |
| 45 | |
| 46 | typedef GrXPFactory INHERITED; |
| 47 | }; |
| 48 | |
| 49 | #endif |
| 50 | |