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

Unified Diff: src/effects/SkMatrixImageFilter.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: revised understanding : input filter count is requred, but elements may be null 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/SkMatrixImageFilter.cpp
diff --git a/src/effects/SkMatrixImageFilter.cpp b/src/effects/SkMatrixImageFilter.cpp
index c7c815a761dec37b3acb782bba71220ee4a69352..5b234a686e584764ee36e4e8ca636b30e78cc99d 100644
--- a/src/effects/SkMatrixImageFilter.cpp
+++ b/src/effects/SkMatrixImageFilter.cpp
@@ -29,14 +29,27 @@ SkMatrixImageFilter* SkMatrixImageFilter::Create(const SkMatrix& transform,
return SkNEW_ARGS(SkMatrixImageFilter, (transform, filterLevel, input));
}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkMatrixImageFilter::SkMatrixImageFilter(SkReadBuffer& buffer)
: INHERITED(1, buffer) {
buffer.readMatrix(&fTransform);
fFilterLevel = static_cast<SkPaint::FilterLevel>(buffer.readInt());
}
+#endif
+
+SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) {
+ Common common;
+ if (!common.unflatten(buffer, 1)) {
+ return NULL;
+ }
+ SkMatrix matrix;
+ buffer.readMatrix(&matrix);
+ SkPaint::FilterLevel level = static_cast<SkPaint::FilterLevel>(buffer.readInt());
+ return Create(matrix, level, common.inputAt(0));
+}
void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
+ this->flattenCommon(buffer);
buffer.writeMatrix(fTransform);
buffer.writeInt(fFilterLevel);
}

Powered by Google App Engine
This is Rietveld 408576698