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

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: alternative with flag 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 | « gyp/tests.gyp ('k') | tests/AndroidPaintTest.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..d3a6c5b714a3ea77708442f1eb7b7d4dea5a1434 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -2003,8 +2003,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,
+ kHasPaintOptionsAndroid_FlatFlag = 0x04,
};
// The size of a flat paint's POD fields
@@ -2036,7 +2037,9 @@ void SkPaint::flatten(SkFlattenableWriteBuffer& buffer) const {
asint(this->getImageFilter())) {
flatFlags |= kHasEffects_FlatFlag;
}
-
+#if SK_BUILD_FOR_ANDROID
+ flatFlags |= kHasPaintOptionsAndroid_FlatFlag;
+#endif
if (buffer.isOrderedBinaryBuffer()) {
SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize);
@@ -2095,6 +2098,9 @@ void SkPaint::flatten(SkFlattenableWriteBuffer& buffer) const {
buffer.writeFlattenable(this->getImageFilter());
buffer.writeFlattenable(this->getAnnotation());
}
+#if SK_BUILD_FOR_ANDROID
+ this->getPaintOptionsAndroid().flatten(buffer);
+#endif
}
void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) {
@@ -2180,6 +2186,13 @@ void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) {
this->setLooper(NULL);
this->setImageFilter(NULL);
}
+#if SK_BUILD_FOR_ANDROID
+ if (flatFlags & kHasPaintOptionsAndroid_FlatFlag) {
+ SkPaintOptionsAndroid options;
+ options.unflatten(buffer);
+ this->setPaintOptionsAndroid(options);
+ }
+#endif
reed1 2013/09/18 18:37:40 need #else // not android, need to eat these byte
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « gyp/tests.gyp ('k') | tests/AndroidPaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698