| 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 |
| 11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
| 12 #include "GrXferProcessor.h" | 12 #include "GrXferProcessor.h" |
| 13 #include "SkRegion.h" | 13 #include "SkRegion.h" |
| 14 | 14 |
| 15 class GrProcOptInfo; | 15 class GrProcOptInfo; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * This xfer processor directly blends the the src coverage with the dst using a
set operator. It is | 18 * This xfer processor directly blends the the src coverage with the dst using a
set operator. It is |
| 19 * useful for rendering coverage masks using CSG. It can optionally invert the s
rc coverage before | 19 * useful for rendering coverage masks using CSG. It can optionally invert the s
rc coverage before |
| 20 * applying the set operator. | 20 * applying the set operator. |
| 21 */ | 21 */ |
| 22 class GrCoverageSetOpXPFactory : public GrXPFactory { | 22 class GrCoverageSetOpXPFactory : public GrXPFactory { |
| 23 public: | 23 public: |
| 24 static GrXPFactory* Create(SkRegion::Op regionOp, bool invertCoverage = fals
e); | 24 static GrXPFactory* Create(SkRegion::Op regionOp, bool invertCoverage = fals
e); |
| 25 | 25 |
| 26 bool supportsRGBCoverage(GrColor /*knownColor*/, | 26 bool supportsRGBCoverage(GrColor /*knownColor*/, |
| 27 uint32_t /*knownColorFlags*/) const SK_OVERRIDE { | 27 uint32_t /*knownColorFlags*/) const override { |
| 28 return true; | 28 return true; |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; } | 31 bool canTweakAlphaForCoverage() const override { return false; } |
| 32 | 32 |
| 33 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | 33 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, |
| 34 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 34 GrXPFactory::InvariantOutput*) const override; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage); | 37 GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage); |
| 38 | 38 |
| 39 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, | 39 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, |
| 40 const GrProcOptInfo& colorPOI, | 40 const GrProcOptInfo& colorPOI, |
| 41 const GrProcOptInfo& coveragePOI, | 41 const GrProcOptInfo& coveragePOI, |
| 42 const GrDeviceCoordTexture* dstCopy)
const SK_OVERRIDE; | 42 const GrDeviceCoordTexture* dstCopy)
const override; |
| 43 | 43 |
| 44 bool willReadDstColor(const GrDrawTargetCaps& /*caps*/, | 44 bool willReadDstColor(const GrDrawTargetCaps& /*caps*/, |
| 45 const GrProcOptInfo& /*colorPOI*/, | 45 const GrProcOptInfo& /*colorPOI*/, |
| 46 const GrProcOptInfo& /*coveragePOI*/) const SK_OVERRID
E { | 46 const GrProcOptInfo& /*coveragePOI*/) const override { |
| 47 return false; | 47 return false; |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 50 bool onIsEqual(const GrXPFactory& xpfBase) const override { |
| 51 const GrCoverageSetOpXPFactory& xpf = xpfBase.cast<GrCoverageSetOpXPFact
ory>(); | 51 const GrCoverageSetOpXPFactory& xpf = xpfBase.cast<GrCoverageSetOpXPFact
ory>(); |
| 52 return fRegionOp == xpf.fRegionOp; | 52 return fRegionOp == xpf.fRegionOp; |
| 53 } | 53 } |
| 54 | 54 |
| 55 GR_DECLARE_XP_FACTORY_TEST; | 55 GR_DECLARE_XP_FACTORY_TEST; |
| 56 | 56 |
| 57 SkRegion::Op fRegionOp; | 57 SkRegion::Op fRegionOp; |
| 58 bool fInvertCoverage; | 58 bool fInvertCoverage; |
| 59 | 59 |
| 60 typedef GrXPFactory INHERITED; | 60 typedef GrXPFactory INHERITED; |
| 61 }; | 61 }; |
| 62 #endif | 62 #endif |
| 63 | 63 |
| OLD | NEW |