Index: src/core/SkXfermode.cpp |
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp |
index a22035e804331482b924bd977a8274e0e7cbd026..3cb03703bb06956e9f02c071cf836f88a28d2d5d 100644 |
--- a/src/core/SkXfermode.cpp |
+++ b/src/core/SkXfermode.cpp |
@@ -1343,6 +1343,22 @@ GrEffectRef* XferEffect::TestCreate(SkRandom* rand, |
/////////////////////////////////////////////////////////////////////////////// |
/////////////////////////////////////////////////////////////////////////////// |
+SkProcCoeffXfermode::SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { |
tfarina
2013/11/21 23:45:07
Does SkProcCoeffXfermode deserve its own cpp file?
|
+ uint32_t mode32 = buffer.read32() % SK_ARRAY_COUNT(gProcCoeffs); |
+ if (mode32 >= SK_ARRAY_COUNT(gProcCoeffs)) { |
+ // out of range, just set to something harmless |
+ mode32 = SkXfermode::kSrcOut_Mode; |
+ } |
+ fMode = (SkXfermode::Mode)mode32; |
+ |
+ const ProcCoeff& rec = gProcCoeffs[fMode]; |
+ // these may be valid, or may be CANNOT_USE_COEFF |
+ fSrcCoeff = rec.fSC; |
+ fDstCoeff = rec.fDC; |
+ // now update our function-ptr in the super class |
+ this->INHERITED::setProc(rec.fProc); |
+} |
+ |
bool SkProcCoeffXfermode::asMode(Mode* mode) const { |
if (mode) { |
*mode = fMode; |