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 
16 class GrDisableColorXPFactory : public GrXPFactory {
17 public:
Create()18     static GrXPFactory* Create() {
19         return SkNEW(GrDisableColorXPFactory);
20     }
21 
supportsRGBCoverage(GrColor knownColor,uint32_t knownColorFlags)22     bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const override {
23         return true;
24     }
25 
getInvariantOutput(const GrProcOptInfo & colorPOI,const GrProcOptInfo & coveragePOI,GrXPFactory::InvariantOutput * output)26     void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
27                             GrXPFactory::InvariantOutput* output) const override {
28         output->fBlendedColorFlags = 0;
29         output->fWillBlendWithDst = 0;
30     }
31 
32 private:
33     GrDisableColorXPFactory();
34 
35     GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
36                                            const GrProcOptInfo& colorPOI,
37                                            const GrProcOptInfo& coveragePOI,
38                                            const GrDeviceCoordTexture* dstCopy) const override;
39 
willReadDstColor(const GrDrawTargetCaps & caps,const GrProcOptInfo & colorPOI,const GrProcOptInfo & coveragePOI)40     bool willReadDstColor(const GrDrawTargetCaps& caps,
41                           const GrProcOptInfo& colorPOI,
42                           const GrProcOptInfo& coveragePOI) const override {
43         return false;
44     }
45 
onIsEqual(const GrXPFactory & xpfBase)46     bool onIsEqual(const GrXPFactory& xpfBase) const override {
47         return true;
48     }
49 
50     GR_DECLARE_XP_FACTORY_TEST;
51 
52     typedef GrXPFactory INHERITED;
53 };
54 
55 #endif
56 
57