Index: src/effects/SkAvoidXfermode.cpp |
diff --git a/src/effects/SkAvoidXfermode.cpp b/src/effects/SkAvoidXfermode.cpp |
index ffe6a219ab8f991a42565b76a60ef453d21c7e95..aae6ba5f116a2d121719621ebee7152dedb9c2b5 100644 |
--- a/src/effects/SkAvoidXfermode.cpp |
+++ b/src/effects/SkAvoidXfermode.cpp |
@@ -15,24 +15,30 @@ SkAvoidXfermode::SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode) { |
if (tolerance > 255) { |
tolerance = 255; |
} |
- |
+ fTolerance = SkToU8(tolerance); |
fOpColor = opColor; |
fDistMul = (256 << 14) / (tolerance + 1); |
fMode = mode; |
} |
-SkAvoidXfermode::SkAvoidXfermode(SkReadBuffer& buffer) |
- : INHERITED(buffer) { |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkAvoidXfermode::SkAvoidXfermode(SkReadBuffer& buffer) : INHERITED(buffer) { |
fOpColor = buffer.readColor(); |
fDistMul = buffer.readUInt(); |
fMode = (Mode)buffer.readUInt(); |
} |
+#endif |
-void SkAvoidXfermode::flatten(SkWriteBuffer& buffer) const { |
- this->INHERITED::flatten(buffer); |
+SkFlattenable* SkAvoidXfermode::CreateProc(SkReadBuffer& buffer) { |
+ const SkColor color = buffer.readColor(); |
+ const unsigned tolerance = buffer.readUInt(); |
+ const unsigned mode = buffer.readUInt(); |
+ return Create(color, tolerance, (Mode)mode); |
+} |
+void SkAvoidXfermode::flatten(SkWriteBuffer& buffer) const { |
buffer.writeColor(fOpColor); |
- buffer.writeUInt(fDistMul); |
+ buffer.writeUInt(fTolerance); |
buffer.writeUInt(fMode); |
} |