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 SK_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 SK_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 SK_OVERRIDE; |
32 | 32 |
33 virtual bool asMode(Mode* mode) const SK_OVERRIDE; | 33 virtual bool asMode(Mode* mode) const SK_OVERRIDE; |
34 | 34 |
35 virtual bool asCoeff(Coeff* sc, Coeff* dc) const SK_OVERRIDE; | 35 virtual bool asCoeff(Coeff* sc, Coeff* dc) const SK_OVERRIDE; |
36 | 36 |
37 #if SK_SUPPORT_GPU | 37 #if SK_SUPPORT_GPU |
38 virtual bool asFragmentProcessor(GrFragmentProcessor**, | 38 virtual bool asFragmentProcessor(GrFragmentProcessor**, |
39 GrTexture* background) const SK_OVERRIDE; | 39 GrTexture* background) const SK_OVERRIDE; |
40 #endif | 40 #endif |
41 | 41 |
42 SK_TO_STRING_OVERRIDE() | 42 SK_TO_STRING_OVERRIDE() |
43 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode) | 43 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode) |
44 | 44 |
45 protected: | 45 protected: |
46 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
47 SkProcCoeffXfermode(SkReadBuffer& buffer); | |
48 #endif | |
49 | |
50 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; | 46 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
51 | 47 |
52 Mode getMode() const { return fMode; } | 48 Mode getMode() const { return fMode; } |
53 | 49 |
54 SkXfermodeProc getProc() const { return fProc; } | 50 SkXfermodeProc getProc() const { return fProc; } |
55 | 51 |
56 private: | 52 private: |
57 SkXfermodeProc fProc; | 53 SkXfermodeProc fProc; |
58 Mode fMode; | 54 Mode fMode; |
59 Coeff fSrcCoeff, fDstCoeff; | 55 Coeff fSrcCoeff, fDstCoeff; |
60 | 56 |
61 friend class SkXfermode; | 57 friend class SkXfermode; |
62 | 58 |
63 typedef SkXfermode INHERITED; | 59 typedef SkXfermode INHERITED; |
64 }; | 60 }; |
65 | 61 |
66 #endif // #ifndef SkXfermode_proccoeff_DEFINED | 62 #endif // #ifndef SkXfermode_proccoeff_DEFINED |
OLD | NEW |