| 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 #ifndef GrCoverageSetOpXP_DEFINED | 8 #ifndef GrCoverageSetOpXP_DEFINED | 
| 9 #define GrCoverageSetOpXP_DEFINED | 9 #define GrCoverageSetOpXP_DEFINED | 
| 10 | 10 | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 22 class GrCoverageSetOpXP : public GrXferProcessor { | 22 class GrCoverageSetOpXP : public GrXferProcessor { | 
| 23 public: | 23 public: | 
| 24     static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) { | 24     static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) { | 
| 25         return SkNEW_ARGS(GrCoverageSetOpXP, (regionOp, invertCoverage)); | 25         return SkNEW_ARGS(GrCoverageSetOpXP, (regionOp, invertCoverage)); | 
| 26     } | 26     } | 
| 27 | 27 | 
| 28     ~GrCoverageSetOpXP() SK_OVERRIDE; | 28     ~GrCoverageSetOpXP() SK_OVERRIDE; | 
| 29 | 29 | 
| 30     const char* name() const SK_OVERRIDE { return "Coverage Set Op"; } | 30     const char* name() const SK_OVERRIDE { return "Coverage Set Op"; } | 
| 31 | 31 | 
|  | 32     void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const
      SK_OVERRIDE; | 
|  | 33 | 
| 32     GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; | 34     GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; | 
| 33 | 35 | 
| 34     bool hasSecondaryOutput() const SK_OVERRIDE { return false; } | 36     bool hasSecondaryOutput() const SK_OVERRIDE { return false; } | 
| 35 | 37 | 
| 36     GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | 38     GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | 
| 37                                                const GrProcOptInfo& coveragePOI, | 39                                                const GrProcOptInfo& coveragePOI, | 
| 38                                                bool doesStencilWrite, | 40                                                bool doesStencilWrite, | 
| 39                                                GrColor* color, | 41                                                GrColor* color, | 
| 40                                                const GrDrawTargetCaps& caps) SK_
     OVERRIDE; | 42                                                const GrDrawTargetCaps& caps) SK_
     OVERRIDE; | 
| 41 | 43 | 
| 42     void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; | 44     void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; | 
| 43 | 45 | 
| 44     bool invertCoverage() const { return fInvertCoverage; } | 46     bool invertCoverage() const { return fInvertCoverage; } | 
| 45 | 47 | 
| 46 private: | 48 private: | 
| 47     GrCoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage); | 49     GrCoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage); | 
| 48 | 50 | 
| 49     void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con
     st SK_OVERRIDE; |  | 
| 50 |  | 
| 51     bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { | 51     bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { | 
| 52         const GrCoverageSetOpXP& xp = xpBase.cast<GrCoverageSetOpXP>(); | 52         const GrCoverageSetOpXP& xp = xpBase.cast<GrCoverageSetOpXP>(); | 
| 53         return (fRegionOp == xp.fRegionOp && | 53         return (fRegionOp == xp.fRegionOp && | 
| 54                 fInvertCoverage == xp.fInvertCoverage); | 54                 fInvertCoverage == xp.fInvertCoverage); | 
| 55     } | 55     } | 
| 56 | 56 | 
| 57     SkRegion::Op fRegionOp; | 57     SkRegion::Op fRegionOp; | 
| 58     bool         fInvertCoverage; | 58     bool         fInvertCoverage; | 
| 59 | 59 | 
| 60     typedef GrXferProcessor INHERITED; | 60     typedef GrXferProcessor INHERITED; | 
| 61 }; | 61 }; | 
| 62 | 62 | 
| 63 /////////////////////////////////////////////////////////////////////////////// | 63 /////////////////////////////////////////////////////////////////////////////// | 
| 64 | 64 | 
| 65 class GrCoverageSetOpXPFactory : public GrXPFactory { | 65 class GrCoverageSetOpXPFactory : public GrXPFactory { | 
| 66 public: | 66 public: | 
| 67     static GrXPFactory* Create(SkRegion::Op regionOp, bool invertCoverage = fals
     e); | 67     static GrXPFactory* Create(SkRegion::Op regionOp, bool invertCoverage = fals
     e); | 
| 68 | 68 | 
|  | 69     GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI, | 
|  | 70                                          const GrProcOptInfo& coveragePOI) const
      SK_OVERRIDE; | 
|  | 71 | 
| 69     bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
      SK_OVERRIDE { | 72     bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
      SK_OVERRIDE { | 
| 70         return true; | 73         return true; | 
| 71     } | 74     } | 
| 72 | 75 | 
| 73     bool canApplyCoverage(const GrProcOptInfo& colorPOI, | 76     bool canApplyCoverage(const GrProcOptInfo& colorPOI, | 
| 74                           const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | 77                           const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | 
| 75         return true; | 78         return true; | 
| 76     } | 79     } | 
| 77 | 80 | 
| 78     bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; } | 81     bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; } | 
| 79 | 82 | 
| 80     void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& 
     coveragePOI, | 83     void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& 
     coveragePOI, | 
| 81                             GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 84                             GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 
| 82 | 85 | 
|  | 86     bool willReadDst() const SK_OVERRIDE { return false; } | 
|  | 87 | 
| 83 private: | 88 private: | 
| 84     GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage); | 89     GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage); | 
| 85 | 90 | 
| 86     GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI, |  | 
| 87                                            const GrProcOptInfo& coveragePOI, |  | 
| 88                                            const GrDeviceCoordTexture* dstCopy) 
     const SK_OVERRIDE; |  | 
| 89 |  | 
| 90     bool willReadDstColor() const SK_OVERRIDE { return false; } |  | 
| 91 |  | 
| 92     bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 91     bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 
| 93         const GrCoverageSetOpXPFactory& xpf = xpfBase.cast<GrCoverageSetOpXPFact
     ory>(); | 92         const GrCoverageSetOpXPFactory& xpf = xpfBase.cast<GrCoverageSetOpXPFact
     ory>(); | 
| 94         return fRegionOp == xpf.fRegionOp; | 93         return fRegionOp == xpf.fRegionOp; | 
| 95     } | 94     } | 
| 96 | 95 | 
| 97     GR_DECLARE_XP_FACTORY_TEST; | 96     GR_DECLARE_XP_FACTORY_TEST; | 
| 98 | 97 | 
| 99     SkRegion::Op fRegionOp; | 98     SkRegion::Op fRegionOp; | 
| 100     bool         fInvertCoverage; | 99     bool         fInvertCoverage; | 
| 101 | 100 | 
| 102     typedef GrXPFactory INHERITED; | 101     typedef GrXPFactory INHERITED; | 
| 103 }; | 102 }; | 
| 104 #endif | 103 #endif | 
| 105 | 104 | 
| OLD | NEW | 
|---|