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

Unified Diff: src/effects/SkColorFilterImageFilter.cpp

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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
Index: src/effects/SkColorFilterImageFilter.cpp
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 2c3706769fa400a91e8ffdf3aa9a1e03c097e2e1..007890467f982933908313d4d475a3579351d9f8 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -83,14 +83,30 @@ SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
SkSafeRef(cf);
}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer)
: INHERITED(1, buffer) {
fColorFilter = buffer.readColorFilter();
}
+#endif
-void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
+SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) {
+ Common common;
+ if (!common.unflatten(buffer)) {
+ return NULL;
+ }
+
+ SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter());
+ if (common.inputCount() > 1 || NULL == cf.get()) {
Stephen White 2014/07/17 21:29:00 Nit: if we did pass the expected count to Common's
reed1 2014/07/18 13:40:30 The input-filter appears to be optional, reading t
Stephen White 2014/07/18 14:06:20 Yes, it's optional, in the sense that it can be NU
+ buffer.validate(false);
+ return NULL;
+ }
+ SkImageFilter* imf = common.inputCount() ? common.inputs()[0] : NULL;
+ return Create(cf, imf, &common.cropRect());
+}
+void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const {
+ this->flattenCommon(buffer);
buffer.writeFlattenable(fColorFilter);
}

Powered by Google App Engine
This is Rietveld 408576698