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

Unified Diff: src/core/SkPaint.cpp

Issue 26606004: change SkAnnotation to not inherit from SkFlattenable (does not need dynamic factories) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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/core/SkAnnotation.cpp ('k') | src/pipe/SkGPipePriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/core/SkAnnotation.cpp ('k') | src/pipe/SkGPipePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698