| OLD | NEW |
| (Empty) |
| 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 GrCoverageSetOpXP_DEFINED | |
| 9 #define GrCoverageSetOpXP_DEFINED | |
| 10 | |
| 11 #include "GrTypes.h" | |
| 12 #include "GrXferProcessor.h" | |
| 13 #include "SkRegion.h" | |
| 14 | |
| 15 class GrProcOptInfo; | |
| 16 | |
| 17 class GrCoverageSetOpXPFactory : public GrXPFactory { | |
| 18 public: | |
| 19 static GrXPFactory* Create(SkRegion::Op regionOp, bool invertCoverage = fals
e); | |
| 20 | |
| 21 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE { | |
| 22 return true; | |
| 23 } | |
| 24 | |
| 25 bool canApplyCoverage(const GrProcOptInfo& colorPOI, | |
| 26 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | |
| 27 return true; | |
| 28 } | |
| 29 | |
| 30 bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; } | |
| 31 | |
| 32 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | |
| 33 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | |
| 34 | |
| 35 private: | |
| 36 GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage); | |
| 37 | |
| 38 GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI, | |
| 39 const GrProcOptInfo& coveragePOI, | |
| 40 const GrDeviceCoordTexture* dstCopy)
const SK_OVERRIDE; | |
| 41 | |
| 42 bool willReadDstColor(const GrProcOptInfo& colorPOI, | |
| 43 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | |
| 44 return false; | |
| 45 } | |
| 46 | |
| 47 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | |
| 48 const GrCoverageSetOpXPFactory& xpf = xpfBase.cast<GrCoverageSetOpXPFact
ory>(); | |
| 49 return fRegionOp == xpf.fRegionOp; | |
| 50 } | |
| 51 | |
| 52 GR_DECLARE_XP_FACTORY_TEST; | |
| 53 | |
| 54 SkRegion::Op fRegionOp; | |
| 55 bool fInvertCoverage; | |
| 56 | |
| 57 typedef GrXPFactory INHERITED; | |
| 58 }; | |
| 59 #endif | |
| 60 | |
| OLD | NEW |