| 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 | |
| 34 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; | 32 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; |
| 35 | 33 |
| 36 bool hasSecondaryOutput() const SK_OVERRIDE { return false; } | 34 bool hasSecondaryOutput() const SK_OVERRIDE { return false; } |
| 37 | 35 |
| 38 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | 36 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, |
| 39 const GrProcOptInfo& coveragePOI, | 37 const GrProcOptInfo& coveragePOI, |
| 40 bool doesStencilWrite, | 38 bool doesStencilWrite, |
| 41 GrColor* color, | 39 GrColor* color, |
| 42 const GrDrawTargetCaps& caps) SK_
OVERRIDE; | 40 const GrDrawTargetCaps& caps) SK_
OVERRIDE; |
| 43 | 41 |
| 44 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; | 42 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; |
| 45 | 43 |
| 46 bool invertCoverage() const { return fInvertCoverage; } | 44 bool invertCoverage() const { return fInvertCoverage; } |
| 47 | 45 |
| 48 private: | 46 private: |
| 49 GrCoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage); | 47 GrCoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage); |
| 50 | 48 |
| 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 | |
| 72 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE { | 69 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE { |
| 73 return true; | 70 return true; |
| 74 } | 71 } |
| 75 | 72 |
| 76 bool canApplyCoverage(const GrProcOptInfo& colorPOI, | 73 bool canApplyCoverage(const GrProcOptInfo& colorPOI, |
| 77 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | 74 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { |
| 78 return true; | 75 return true; |
| 79 } | 76 } |
| 80 | 77 |
| 81 bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; } | 78 bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; } |
| 82 | 79 |
| 83 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | 80 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, |
| 84 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 81 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; |
| 85 | 82 |
| 86 bool willReadDst() const SK_OVERRIDE { return false; } | |
| 87 | |
| 88 private: | 83 private: |
| 89 GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage); | 84 GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage); |
| 90 | 85 |
| 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 |
| 91 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 92 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { |
| 92 const GrCoverageSetOpXPFactory& xpf = xpfBase.cast<GrCoverageSetOpXPFact
ory>(); | 93 const GrCoverageSetOpXPFactory& xpf = xpfBase.cast<GrCoverageSetOpXPFact
ory>(); |
| 93 return fRegionOp == xpf.fRegionOp; | 94 return fRegionOp == xpf.fRegionOp; |
| 94 } | 95 } |
| 95 | 96 |
| 96 GR_DECLARE_XP_FACTORY_TEST; | 97 GR_DECLARE_XP_FACTORY_TEST; |
| 97 | 98 |
| 98 SkRegion::Op fRegionOp; | 99 SkRegion::Op fRegionOp; |
| 99 bool fInvertCoverage; | 100 bool fInvertCoverage; |
| 100 | 101 |
| 101 typedef GrXPFactory INHERITED; | 102 typedef GrXPFactory INHERITED; |
| 102 }; | 103 }; |
| 103 #endif | 104 #endif |
| 104 | 105 |
| OLD | NEW |