| OLD | NEW |
| (Empty) |
| 1 #ifndef SkXfermode_proccoeff_DEFINED | |
| 2 #define SkXfermode_proccoeff_DEFINED | |
| 3 | |
| 4 #include "SkXfermode.h" | |
| 5 #include "SkFlattenableBuffers.h" | |
| 6 | |
| 7 struct ProcCoeff { | |
| 8 SkXfermodeProc fProc; | |
| 9 SkXfermode::Coeff fSC; | |
| 10 SkXfermode::Coeff fDC; | |
| 11 }; | |
| 12 | |
| 13 #define CANNOT_USE_COEFF SkXfermode::Coeff(-1) | |
| 14 | |
| 15 extern const ProcCoeff gProcCoeffs[]; | |
| 16 | |
| 17 class SkProcCoeffXfermode : public SkProcXfermode { | |
| 18 public: | |
| 19 SkProcCoeffXfermode(const ProcCoeff& rec, Mode mode) | |
| 20 : INHERITED(rec.fProc) { | |
| 21 fMode = mode; | |
| 22 // these may be valid, or may be CANNOT_USE_COEFF | |
| 23 fSrcCoeff = rec.fSC; | |
| 24 fDstCoeff = rec.fDC; | |
| 25 } | |
| 26 | |
| 27 virtual bool asMode(Mode* mode) const SK_OVERRIDE; | |
| 28 | |
| 29 virtual bool asCoeff(Coeff* sc, Coeff* dc) const SK_OVERRIDE; | |
| 30 | |
| 31 #if SK_SUPPORT_GPU | |
| 32 virtual bool asNewEffectOrCoeff(GrContext*, | |
| 33 GrEffectRef** effect, | |
| 34 Coeff* src, | |
| 35 Coeff* dst, | |
| 36 GrTexture* background) const SK_OVERRIDE; | |
| 37 #endif | |
| 38 | |
| 39 SK_DEVELOPER_TO_STRING() | |
| 40 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode) | |
| 41 | |
| 42 protected: | |
| 43 SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { | |
| 44 fMode = (SkXfermode::Mode)buffer.read32(); | |
| 45 | |
| 46 const ProcCoeff& rec = gProcCoeffs[fMode]; | |
| 47 // these may be valid, or may be CANNOT_USE_COEFF | |
| 48 fSrcCoeff = rec.fSC; | |
| 49 fDstCoeff = rec.fDC; | |
| 50 // now update our function-ptr in the super class | |
| 51 this->INHERITED::setProc(rec.fProc); | |
| 52 } | |
| 53 | |
| 54 virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE; | |
| 55 | |
| 56 private: | |
| 57 Mode fMode; | |
| 58 Coeff fSrcCoeff, fDstCoeff; | |
| 59 | |
| 60 typedef SkProcXfermode INHERITED; | |
| 61 }; | |
| 62 | |
| 63 #endif // #ifndef SkXfermode_proccoeff_DEFINED | |
| OLD | NEW |