Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: src/effects/SkAvoidXfermode.cpp

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkBitmapSource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkBitmapSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698