Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index ea99ede665d786b222ee1d6530ae613529a7f84a..4e186ac379b899d203c57755dc3a7cbe9c725614 100644 |
--- a/src/core/SkPaint.cpp |
+++ b/src/core/SkPaint.cpp |
@@ -2099,7 +2099,13 @@ void SkPaint::flatten(SkFlattenableWriteBuffer& buffer) const { |
buffer.writeFlattenable(this->getRasterizer()); |
buffer.writeFlattenable(this->getLooper()); |
buffer.writeFlattenable(this->getImageFilter()); |
- buffer.writeFlattenable(this->getAnnotation()); |
+ |
+ if (fAnnotation) { |
+ buffer.writeBool(true); |
+ fAnnotation->writeToBuffer(buffer); |
+ } else { |
+ buffer.writeBool(false); |
+ } |
} |
#ifdef SK_BUILD_FOR_ANDROID |
if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) { |
@@ -2180,7 +2186,10 @@ void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) { |
SkSafeUnref(this->setRasterizer(buffer.readFlattenableT<SkRasterizer>())); |
SkSafeUnref(this->setLooper(buffer.readFlattenableT<SkDrawLooper>())); |
SkSafeUnref(this->setImageFilter(buffer.readFlattenableT<SkImageFilter>())); |
- SkSafeUnref(this->setAnnotation(buffer.readFlattenableT<SkAnnotation>())); |
+ |
+ if (buffer.readBool()) { |
+ this->setAnnotation(SkNEW_ARGS(SkAnnotation, (buffer)))->unref(); |
+ } |
} else { |
this->setPathEffect(NULL); |
this->setShader(NULL); |