Index: src/core/SkXfermode.cpp |
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp |
index e0abb4ebdd8f735a3410ef521122f538991843d1..4a3ec397022e34a6201feeafde73032a7915332a 100644 |
--- a/src/core/SkXfermode.cpp |
+++ b/src/core/SkXfermode.cpp |
@@ -1237,6 +1237,23 @@ |
/////////////////////////////////////////////////////////////////////////////// |
/////////////////////////////////////////////////////////////////////////////// |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkProcCoeffXfermode::SkProcCoeffXfermode(SkReadBuffer& buffer) : INHERITED(buffer) { |
+ 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]; |
+ fProc = rec.fProc; |
+ // these may be valid, or may be CANNOT_USE_COEFF |
+ fSrcCoeff = rec.fSC; |
+ fDstCoeff = rec.fDC; |
+} |
+#endif |
+ |
SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) { |
uint32_t mode32 = buffer.read32(); |
if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) { |
@@ -1426,6 +1443,9 @@ |
private: |
SkClearXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kClear_Mode) {} |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+ SkClearXfermode(SkReadBuffer& buffer) : SkProcCoeffXfermode(buffer) {} |
+#endif |
typedef SkProcCoeffXfermode INHERITED; |
}; |
@@ -1488,6 +1508,9 @@ |
private: |
SkSrcXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kSrc_Mode) {} |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+ SkSrcXfermode(SkReadBuffer& buffer) : SkProcCoeffXfermode(buffer) {} |
+#endif |
typedef SkProcCoeffXfermode INHERITED; |
}; |
@@ -1553,6 +1576,9 @@ |
private: |
SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode) {} |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+ SkDstInXfermode(SkReadBuffer& buffer) : INHERITED(buffer) {} |
+#endif |
typedef SkProcCoeffXfermode INHERITED; |
}; |
@@ -1597,6 +1623,9 @@ |
private: |
SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mode) {} |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+ SkDstOutXfermode(SkReadBuffer& buffer) : INHERITED(buffer) {} |
+#endif |
typedef SkProcCoeffXfermode INHERITED; |
}; |