OLD | NEW |
1 #ifndef SkXfermode_proccoeff_DEFINED | 1 #ifndef SkXfermode_proccoeff_DEFINED |
2 #define SkXfermode_proccoeff_DEFINED | 2 #define SkXfermode_proccoeff_DEFINED |
3 | 3 |
4 #include "SkXfermode.h" | 4 #include "SkXfermode.h" |
5 #include "SkReadBuffer.h" | 5 #include "SkReadBuffer.h" |
6 #include "SkWriteBuffer.h" | 6 #include "SkWriteBuffer.h" |
7 | 7 |
8 struct ProcCoeff { | 8 struct ProcCoeff { |
9 SkXfermodeProc fProc; | 9 SkXfermodeProc fProc; |
10 SkXfermode::Coeff fSC; | 10 SkXfermode::Coeff fSC; |
11 SkXfermode::Coeff fDC; | 11 SkXfermode::Coeff fDC; |
12 }; | 12 }; |
13 | 13 |
14 #define CANNOT_USE_COEFF SkXfermode::Coeff(-1) | 14 #define CANNOT_USE_COEFF SkXfermode::Coeff(-1) |
15 | 15 |
16 class SK_API SkProcCoeffXfermode : public SkXfermode { | 16 class SK_API SkProcCoeffXfermode : public SkXfermode { |
17 public: | 17 public: |
18 SkProcCoeffXfermode(const ProcCoeff& rec, Mode mode) { | 18 SkProcCoeffXfermode(const ProcCoeff& rec, Mode mode) { |
19 fMode = mode; | 19 fMode = mode; |
20 fProc = rec.fProc; | 20 fProc = rec.fProc; |
21 // these may be valid, or may be CANNOT_USE_COEFF | 21 // these may be valid, or may be CANNOT_USE_COEFF |
22 fSrcCoeff = rec.fSC; | 22 fSrcCoeff = rec.fSC; |
23 fDstCoeff = rec.fDC; | 23 fDstCoeff = rec.fDC; |
24 } | 24 } |
25 | 25 |
26 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 26 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
27 const SkAlpha aa[]) const SK_OVERRIDE; | 27 const SkAlpha aa[]) const override; |
28 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 28 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
29 const SkAlpha aa[]) const SK_OVERRIDE; | 29 const SkAlpha aa[]) const override; |
30 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 30 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
31 const SkAlpha aa[]) const SK_OVERRIDE; | 31 const SkAlpha aa[]) const override; |
32 | 32 |
33 bool asMode(Mode* mode) const SK_OVERRIDE; | 33 bool asMode(Mode* mode) const override; |
34 | 34 |
35 bool supportsCoverageAsAlpha() const SK_OVERRIDE; | 35 bool supportsCoverageAsAlpha() const override; |
36 | 36 |
37 bool isOpaque(SkXfermode::SrcColorOpacity opacityType) const SK_OVERRIDE; | 37 bool isOpaque(SkXfermode::SrcColorOpacity opacityType) const override; |
38 | 38 |
39 #if SK_SUPPORT_GPU | 39 #if SK_SUPPORT_GPU |
40 virtual bool asFragmentProcessor(GrFragmentProcessor**, | 40 virtual bool asFragmentProcessor(GrFragmentProcessor**, |
41 GrTexture* background) const SK_OVERRIDE; | 41 GrTexture* background) const override; |
42 | 42 |
43 virtual bool asXPFactory(GrXPFactory**) const SK_OVERRIDE; | 43 virtual bool asXPFactory(GrXPFactory**) const override; |
44 #endif | 44 #endif |
45 | 45 |
46 SK_TO_STRING_OVERRIDE() | 46 SK_TO_STRING_OVERRIDE() |
47 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode) | 47 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode) |
48 | 48 |
49 protected: | 49 protected: |
50 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; | 50 void flatten(SkWriteBuffer& buffer) const override; |
51 | 51 |
52 Mode getMode() const { return fMode; } | 52 Mode getMode() const { return fMode; } |
53 | 53 |
54 SkXfermodeProc getProc() const { return fProc; } | 54 SkXfermodeProc getProc() const { return fProc; } |
55 | 55 |
56 private: | 56 private: |
57 SkXfermodeProc fProc; | 57 SkXfermodeProc fProc; |
58 Mode fMode; | 58 Mode fMode; |
59 Coeff fSrcCoeff, fDstCoeff; | 59 Coeff fSrcCoeff, fDstCoeff; |
60 | 60 |
61 friend class SkXfermode; | 61 friend class SkXfermode; |
62 | 62 |
63 typedef SkXfermode INHERITED; | 63 typedef SkXfermode INHERITED; |
64 }; | 64 }; |
65 | 65 |
66 #endif // #ifndef SkXfermode_proccoeff_DEFINED | 66 #endif // #ifndef SkXfermode_proccoeff_DEFINED |
OLD | NEW |