| 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 GrPorterDuffXferProcessor_DEFINED | 8 #ifndef GrPorterDuffXferProcessor_DEFINED |
| 9 #define GrPorterDuffXferProcessor_DEFINED | 9 #define GrPorterDuffXferProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
| 12 #include "GrXferProcessor.h" | 12 #include "GrXferProcessor.h" |
| 13 #include "SkXfermode.h" | 13 #include "SkXfermode.h" |
| 14 | 14 |
| 15 class GrProcOptInfo; | 15 class GrProcOptInfo; |
| 16 | 16 |
| 17 class GrPorterDuffXPFactory : public GrXPFactory { | 17 class GrPorterDuffXPFactory : public GrXPFactory { |
| 18 public: | 18 public: |
| 19 static GrXPFactory* Create(SkXfermode::Mode mode); | 19 static GrXPFactory* Create(SkXfermode::Mode mode); |
| 20 | 20 |
| 21 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE; | 21 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE; |
| 22 | 22 |
| 23 bool canApplyCoverage(const GrProcOptInfo& colorPOI, | 23 bool canApplyCoverage(const GrProcOptInfo& /*colorPOI*/, |
| 24 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; | 24 const GrProcOptInfo& /*coveragePOI*/) const SK_OVERRID
E { |
| 25 return true; |
| 26 } |
| 25 | 27 |
| 26 bool canTweakAlphaForCoverage() const SK_OVERRIDE; | 28 bool canTweakAlphaForCoverage() const SK_OVERRIDE; |
| 27 | 29 |
| 28 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | 30 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, |
| 29 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 31 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst); | 34 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst); |
| 33 | 35 |
| 34 GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI, | 36 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, |
| 37 const GrProcOptInfo& colorPOI, |
| 35 const GrProcOptInfo& coveragePOI, | 38 const GrProcOptInfo& coveragePOI, |
| 36 const GrDeviceCoordTexture* dstCopy)
const SK_OVERRIDE; | 39 const GrDeviceCoordTexture* dstCopy)
const SK_OVERRIDE; |
| 37 | 40 |
| 38 bool willReadDstColor(const GrProcOptInfo& colorPOI, | 41 bool willReadDstColor(const GrDrawTargetCaps& caps, |
| 42 const GrProcOptInfo& colorPOI, |
| 39 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; | 43 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; |
| 40 | 44 |
| 41 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 45 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { |
| 42 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>()
; | 46 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>()
; |
| 43 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff); | 47 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff); |
| 44 } | 48 } |
| 45 | 49 |
| 46 GR_DECLARE_XP_FACTORY_TEST; | 50 GR_DECLARE_XP_FACTORY_TEST; |
| 47 | 51 |
| 48 GrBlendCoeff fSrcCoeff; | 52 GrBlendCoeff fSrcCoeff; |
| 49 GrBlendCoeff fDstCoeff; | 53 GrBlendCoeff fDstCoeff; |
| 50 | 54 |
| 51 typedef GrXPFactory INHERITED; | 55 typedef GrXPFactory INHERITED; |
| 52 }; | 56 }; |
| 53 | 57 |
| 54 #endif | 58 #endif |
| OLD | NEW |