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
override; | 21 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
override; |
22 | 22 |
23 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | 23 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, |
24 GrXPFactory::InvariantOutput*) const override; | 24 GrXPFactory::InvariantOutput*) const override; |
25 | 25 |
26 private: | 26 private: |
27 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst); | 27 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst); |
28 | 28 |
29 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, | 29 GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, |
30 const GrProcOptInfo& colorPOI, | 30 const GrProcOptInfo& colorPOI, |
31 const GrProcOptInfo& coveragePOI, | 31 const GrProcOptInfo& coveragePOI, |
32 const GrDeviceCoordTexture* dstCopy)
const override; | 32 const GrDeviceCoordTexture* dstCopy)
const override; |
33 | 33 |
34 bool willReadDstColor(const GrDrawTargetCaps& caps, | 34 bool willReadDstColor(const GrCaps& caps, |
35 const GrProcOptInfo& colorPOI, | 35 const GrProcOptInfo& colorPOI, |
36 const GrProcOptInfo& coveragePOI) const override; | 36 const GrProcOptInfo& coveragePOI) const override; |
37 | 37 |
38 bool onIsEqual(const GrXPFactory& xpfBase) const override { | 38 bool onIsEqual(const GrXPFactory& xpfBase) const override { |
39 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>()
; | 39 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>()
; |
40 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff); | 40 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff); |
41 } | 41 } |
42 | 42 |
43 GR_DECLARE_XP_FACTORY_TEST; | 43 GR_DECLARE_XP_FACTORY_TEST; |
44 | 44 |
45 GrBlendCoeff fSrcCoeff; | 45 GrBlendCoeff fSrcCoeff; |
46 GrBlendCoeff fDstCoeff; | 46 GrBlendCoeff fDstCoeff; |
47 | 47 |
48 typedef GrXPFactory INHERITED; | 48 typedef GrXPFactory INHERITED; |
49 }; | 49 }; |
50 | 50 |
51 #endif | 51 #endif |
OLD | NEW |