Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index df8b292cedf2e5c69549e359a473397334c543af..8ca9880f2102353093afce027f77a28988cd5190 100644 |
--- a/src/core/SkPaint.cpp |
+++ b/src/core/SkPaint.cpp |
@@ -21,6 +21,7 @@ |
#include "SkOrderedReadBuffer.h" |
#include "SkOrderedWriteBuffer.h" |
#include "SkPaintDefaults.h" |
+#include "SkPaintOptionsAndroid.h" |
#include "SkPathEffect.h" |
#include "SkRasterizer.h" |
#include "SkScalar.h" |
@@ -2003,8 +2004,9 @@ static uint32_t pack_4(unsigned a, unsigned b, unsigned c, unsigned d) { |
} |
enum FlatFlags { |
- kHasTypeface_FlatFlag = 0x01, |
- kHasEffects_FlatFlag = 0x02, |
+ kHasTypeface_FlatFlag = 0x01, |
+ kHasEffects_FlatFlag = 0x02, |
+ kHasNonDefaultPaintOptionsAndroid_FlatFlag = 0x04, |
}; |
// The size of a flat paint's POD fields |
@@ -2036,7 +2038,11 @@ void SkPaint::flatten(SkFlattenableWriteBuffer& buffer) const { |
asint(this->getImageFilter())) { |
flatFlags |= kHasEffects_FlatFlag; |
} |
- |
+#if SK_BUILD_FOR_ANDROID |
+ if (this->getPaintOptionsAndroid() != SkPaintOptionsAndroid()) { |
+ flatFlags |= kHasNonDefaultPaintOptionsAndroid_FlatFlag; |
+ } |
+#endif |
if (buffer.isOrderedBinaryBuffer()) { |
SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize); |
@@ -2095,6 +2101,11 @@ void SkPaint::flatten(SkFlattenableWriteBuffer& buffer) const { |
buffer.writeFlattenable(this->getImageFilter()); |
buffer.writeFlattenable(this->getAnnotation()); |
} |
+#if SK_BUILD_FOR_ANDROID |
+ if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) { |
+ this->getPaintOptionsAndroid().flatten(buffer); |
+ } |
+#endif |
} |
void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) { |
@@ -2180,6 +2191,17 @@ void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) { |
this->setLooper(NULL); |
this->setImageFilter(NULL); |
} |
+ |
+#if SK_BUILD_FOR_ANDROID |
+ this->setPaintOptionsAndroid(SkPaintOptionsAndroid()); |
+#endif |
+ if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) { |
+ SkPaintOptionsAndroid options; |
+ options.unflatten(buffer); |
+#if SK_BUILD_FOR_ANDROID |
+ this->setPaintOptionsAndroid(options); |
+#endif |
+ } |
} |
/////////////////////////////////////////////////////////////////////////////// |