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

Unified Diff: src/core/SkPaint.cpp

Issue 24075010: We don't flatten or unflatten SkPaintOptionsAndroid. Reproduce and fix. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head Created 7 years, 3 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 | « include/core/SkPaintOptionsAndroid.h ('k') | src/core/SkPaintOptionsAndroid.cpp » ('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 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
+ }
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « include/core/SkPaintOptionsAndroid.h ('k') | src/core/SkPaintOptionsAndroid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698